Color Palette Extractor
Add a photo, logo or screenshot and choose how many colours you want to get its main colours as HEX, RGB and HSL codes, with each colour's share of the image and a text contrast check. Copy the palette as CSS variables, a Tailwind theme or JSON, or click the image to sample one point. Nothing is uploaded.
Updated
How to use the Color Palette Extractor
- 1Add an image.
- 2Choose how many colours you want in the palette.
- 3Copy any colour code, or copy the whole palette as CSS variables, a Tailwind theme or JSON.
- 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.
Tips and common mistakes
- Raise the number of colours if a small accent colour is missing; it may have been absorbed into a larger neighbour.
- Click directly on the image to sample one exact spot.
- Use the contrast figures before choosing a colour as a text background: 4.5:1 is the minimum for body text.
- Copy the palette as CSS variables, a Tailwind theme or JSON to drop it straight into a project.