Skip to content
Utilboxes

Color Palette Extractor

Upload a photo, logo or screenshot and get its main colours as HEX, RGB and HSL codes. Click anywhere on the image to sample a single point.

Files never leave your device

How to use the Color Palette Extractor

  1. 1Add an image.
  2. 2Choose how many colours you want in the palette.
  3. 3Copy any colour code, or copy the whole palette as CSS variables, a Tailwind theme or JSON.
  4. 4Click a point on the image to read the colour at that spot.

How it works

The image is scaled down and read pixel by pixel in your browser. Similar pixels are grouped into buckets — 32,768 of them, five bits per colour channel — so a photo with millions of pixels becomes a few thousand weighted colours that can be analysed instantly.

Those colours are clustered with k-means in CIELAB colour space. Distance in CIELAB matches how different two colours look to the eye far more closely than distance in RGB, so the palette favours colours that are visibly distinct rather than several near-identical shades of one background.

The starting points are chosen deterministically — the most common colour first, then whichever colour is furthest from those already chosen — so the same image always gives the same palette. A colour's share is the proportion of the image's opaque pixels closest to it; transparent pixels are ignored.

Each colour also shows whether white or black text reads better on top of it, with the WCAG contrast ratio, which helps when turning a palette into a design.

Frequently asked questions

Why is a small but striking colour missing from the palette?
The palette is weighted by how much of the image each colour covers, so a tiny accent can be absorbed into a larger neighbouring cluster. Increase the number of colours, or click the spot on the image to sample it directly.
Are the colours exact?
Palette colours are the average of their cluster, so they are representative rather than copied from one pixel. The click-to-sample colour is read from a single pixel of the scaled-down copy of your image.
What does the contrast ratio mean?
It is the WCAG 2 contrast between the colour and white or black text. 4.5:1 is the minimum for normal body text at level AA; 3:1 is enough for large text.
Is my image uploaded?
No. The pixels are read and clustered on your own device.