How to use it
- Select Choose an image and pick a photo from your device.
- Read the five extracted colors and their hex codes.
- Lock the colors you want to keep, or edit any swatch.
- Export CSS variables, JSON, a Tailwind theme (v3 or v4) or a PNG swatch.
Worked example
A sunset photo returns five swatches such as a warm orange, a deep blue and a gray, each with a hex code. Lock two, regenerate the rest and copy the CSS variables.
Formats and limits
| Input | Any image your browser opens |
|---|---|
| Output | CSS variables, JSON, Tailwind theme, PNG swatch |
| Engine | OKLCH color math; k-means extraction for images |
Limitations
- The image is downscaled to 128 px on its longest side, so tiny details do not affect the colors.
- Only opaque pixels count; a fully transparent image is rejected.
- An image with fewer than five distinct colors repeats the last color.
- Colors outside sRGB are clipped for display.
Questions
How are the five colors chosen?
The image is downscaled to 128 px on its longest side and its opaque pixels are clustered into five groups; each swatch is the center of one group, so large areas weigh more.
Why does the palette look dull?
Big flat areas such as sky or walls dominate the clusters. Crop the picture to the part you care about and choose it again.
Is my image uploaded?
No. The image is read and analyzed in your browser.
Privacy
Runs on your device. Files and text are processed in this browser tab and are not uploaded.
This page opens the Color palette generator ready for this task. See the privacy policy for how toolsdocks handles data.