# Image colour palette > What are the main colours of this picture? Pull the dominant colours out of any picture: hex, RGB, HSL or OKLCH, one click to copy, or copy them all as CSS variables. Extract the dominant colours from an image as a palette: hex, RGB, HSL or OKLCH values with their share, copy as CSS variables. Works on your device. - Page: https://how.box/image-colors/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/image-colors/?n={n}&f={f} - `n` (whole number 2 to 12): How many dominant colours to pick, 2–12. Example: `6`. - `f` (hex, rgb, hsl or oklch): Notation: hex, rgb, hsl or oklch. Example: `hex`. Example answer: https://how.box/image-colors/?n=6&f=hex The page computes the answer in the browser: read results from the agent tools below, not from the page HTML. ## Agent tools - `image_colors_format`: Write CSS colours you already have (hex, rgb(), hsl(), oklch() or names, 1–12) in one notation (hex, rgb, hsl or oklch) and as CSS custom properties. - MCP: POST https://how.box/mcp `tools/call` with `{"name":"image_colors_format","arguments":{…}}`; input schema in https://how.box/agent-tools.json. ## How it works A picture holds thousands of slightly different colours, so the tool groups them. It samples the pixels and splits them into the number of groups you asked for so that the colours in a group are as alike as possible; each group's average is one palette colour, and its share is the part of the picture it covers. The largest group comes first. Colours are grouped in OKLab, a colour space built so that equal distances look like equal differences to the eye, which keeps a small bright accent from being swallowed by a large dull area. The result is then written in the notation you chose: hex (#e76f51), rgb(231 111 81), hsl(11 76% 62%) or oklch(66% 0.1763 36.8), all valid CSS. The palette is a summary, not a measurement: a different picture crop, size or number of colours gives a slightly different set, and very small details do not show. Photos taken in poor light give a palette of the light as well as the objects. ## FAQ **How does the tool pick the dominant colours?** It sorts the picture's pixels into groups of similar colours and reports the average of each group, largest first. The share tells how much of the picture each colour covers. **How many colours should I extract?** Five or six are enough for most designs: a main colour, a couple of supporting ones and accents. Use more for a photo with many different areas. **Which notation should I use in CSS?** All four work in modern CSS. Hex is the most widely copied; HSL is easy to adjust by hand; OKLCH keeps lightness even across hues, which makes accessible palettes easier. **Why is the palette colour not exactly a pixel in the picture?** Each colour is the average of many similar pixels, so it is a typical colour of that area rather than one particular pixel. **Can I use the colours from a photo?** Colours themselves are not protected, but the picture may be. A palette does not copy the picture, so it is fine to use for design; check the rights of the picture if you reproduce any part of it. **Is my picture uploaded?** No. The picture is read in your browser and reduced to a small thumbnail for the calculation. Nothing is sent anywhere and a shared link carries only the settings. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)