Field guide for designers
Pulling a usable color system out of an image
A photo holds thousands of slightly different colors. A palette is a handful of decisions. The gap between the two is perception: which colors the eye groups together, which it notices, and which it can actually read text on.
01Why averaging pixels gives muddy palettes
The simplest extractor counts pixels in RGB and returns the most common buckets. RGB, however, is built around how screens emit light, not how people see it. Equal steps in RGB are wildly unequal to the eye: two dark greens that look identical can be far apart numerically, while a yellow and an orange that look clearly different sit close together.
Clustering in RGB therefore merges colors you would keep apart and splits colors you would merge, and averaging a cluster of complementary pixels drifts toward grey. This tool converts every pixel to a perceptual space first, where distance tracks visible difference, and only then groups them.
02OKLab, CIELAB and OKLCH in two minutes
| Space | What it is | Use it for |
|---|---|---|
| CIELAB | The 1976 standard: lightness plus two opponent axes (green to red, blue to yellow) | Print, color management, Delta E tolerances |
| OKLab | A 2020 refinement with more even hue spacing, especially in blues and purples | Clustering, gradients, mixing |
| OKLCH | OKLab in polar form: Lightness, Chroma, Hue | CSS values, tonal scales, theming |
OKLCH is the most practical format for design systems because each number does one job. Keep the hue and chroma, change the lightness, and you get a lighter or darker shade of the same color without the hue shifts HSL is known for. All current browsers support oklch() in CSS.
.button { background: oklch(62% 0.17 45); }
.button:hover { background: oklch(55% 0.17 45); } /* darker, same hue */
.button:focus { outline-color: oklch(62% 0.17 45 / 0.4); }
03Dominant, accent and neutral roles
Every swatch the tool returns is labelled by role, because color roles matter more than individual values:
- Dominant colors cover at least 8% of the image. They carry the mood and usually become backgrounds, large surfaces and imagery tints.
- Accent colors cover little area but are clearly more saturated than the rest. In the source image they are what your eye lands on, which is exactly the job they should do in an interface: buttons, links, highlights.
- Neutral colors have almost no chroma. Use them for text, borders and quiet surfaces.
A reliable starting split is the classic 60-30-10 rule: roughly 60% dominant or neutral surface, 30% secondary color, 10% accent. The share percentages on each card show how close the source image already is to that balance.
04From swatches to design tokens
A single hex value is not enough for a real interface. Hover states, disabled states, tinted backgrounds and dark mode all need lighter and darker versions. The export builds an 11-step scale (50 to 950) for every swatch in OKLCH:
- The extracted color is placed at the step whose lightness is closest, so a pale sand color becomes
sand-100rather than being forced into500. - The other steps keep the same hue and spread lightness evenly toward near-white and near-black.
- Chroma tapers at the extremes, and any step outside the sRGB gamut has its chroma reduced until it fits, so every token renders the same on every screen.
Name tokens by role (primary, accent, neutral) rather than by hue (orange). Renaming a role later is a one-line change; renaming every orange-500 in a codebase after a rebrand is not. You can edit each token name directly on its card.
05Contrast before beauty
Each card shows the WCAG 2 contrast ratio of the swatch against white and black text, with the levels it passes:
| Level | Minimum ratio | Applies to |
|---|---|---|
| AA | 4.5 : 1 | Body text |
| AA Large | 3 : 1 | Text from 24px, or 18.66px bold, and UI components such as icons and input borders |
| AAA | 7 : 1 | Body text, enhanced level |
Mid-lightness colors, the oranges and saturated greens images are full of, often fail with both white and black text. Use the generated scale instead: the 700 or 800 step of the same hue usually passes AA with white text while still reading as the brand color.
06Getting better extractions
- Crop first. Borders, watermarks and large white backgrounds pull the palette toward neutrals.
- Start with 6 colors. Fewer forces merges; more reveals secondary hues. Ten is the useful ceiling for a UI palette.
- Use transparent PNGs for logos. Fully transparent pixels are ignored, so only the mark itself is analysed.
- Sort by Lightness to see the value structure of the image at a glance; sort by Hue to spot gaps in the color wheel.