Which colours are in this image?

Load a logo, a photo or a screenshot. Get its main colours as hex and RGB codes, each with the share of the picture it covers and its contrast against white and black text, and copy the palette as CSS custom properties. The image never leaves your device.

or drop it here

PNG, JPEG, WebP, GIF or SVG, and AVIF where your browser opens it. It is read on your device and never uploaded.

How many colours

A logo may have fewer colours than you ask for; the page then shows the ones it has.

How it works

  • Median cut, in your browser. The picture is sampled at up to 240 pixels on its longer side. All its pixels go in one box; the box whose colours spread furthest, weighted by how many pixels it holds, is cut in two at the middle of its widest colour channel, moved to the nearest place where the colour changes so identical pixels stay together. That repeats until there are as many boxes as colours you asked for. It follows the median cut method Paul Heckbert described in 1982.
  • One colour per box. Each colour is the average of the pixels in its box, and its share is how much of the visible picture that box covers. Colours that come out almost the same are joined into one.
  • Transparent parts left out. Pixels that are less than half opaque, such as the clear background of a logo, are not counted, and the result says how much was left out.
  • Contrast with white and black. Each colour shows its contrast ratio with white and with black text, by the same WCAG 2.2 formula as the contrast checker: 4.5:1 for body text and 3:1 for large text (level AA).
  • Ready for CSS. The palette copies as CSS custom properties (--colour-1, --colour-2 and so on) to paste into a stylesheet.

What it can't see

Which colours matter to the brand. The palette follows how much of the picture each colour covers, so a small accent colour can be left out when you ask for few colours. Ask for more and it usually appears.

Exact brand codes. Photos, JPEG compression and soft edges blend colours, so a colour here can be a few steps away from the code in a brand guide. Use the brand guide's codes where you have them.

Colour profiles. The colours are read as your browser draws the picture on screen, in sRGB. A print colour (CMYK or Pantone) has no exact match here.

Questions

Is my image uploaded?

No. It is opened and measured inside your browser, and the page sends nothing to a server.

Why does my logo show the background colour first?

Because it covers most of the picture. Use a version of the logo with a transparent background and the background is left out.

What do the contrast numbers mean?

They say whether white or black text is readable on that colour. WCAG asks for at least 4.5:1 for ordinary text and 3:1 for large text; the higher, the easier to read. Check a pair of your own colours in the contrast checker.

Why are there fewer colours than I asked for?

The picture does not have that many different colours, or some came out almost the same and were joined. A flat logo with three colours gives three.