Skip to content
toolsdocks

Get a Color Palette from an Image

Choose a photo and get its five main colors as hex codes. This page opens the palette generator with the image picker first; the colors fill the palette, where you can lock, edit and export them.

Runs on your device

More options in the full Color palette generator.

Loading tool…

How to use it

  1. Select Choose an image and pick a photo from your device.
  2. Read the five extracted colors and their hex codes.
  3. Lock the colors you want to keep, or edit any swatch.
  4. 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

InputAny image your browser opens
OutputCSS variables, JSON, Tailwind theme, PNG swatch
EngineOKLCH 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.