# Colour Palette from Image

> Get the main colours of any image as HEX, RGB and HSL, pick any colour by clicking, check text contrast, and copy CSS, SCSS, Tailwind or JSON. Free, private.

Canonical: https://cromagnon.app/tools/color-palette
Last updated: 2026-10-26

- Category: Image
- Formats: PNG · JPG · WEBP
- Use it: https://cromagnon.app/tools/color-palette (free, runs in the browser)

## What it does

Find the main colours of any picture, such as a logo, a photo, a website screenshot or a mood board, and use them in your own designs. The palette shows each colour's HEX, RGB and HSL values and how much of the picture it covers, with a readable text sample and its contrast ratio. Click anywhere on the picture to pick an exact colour. Then copy the palette as CSS variables, SCSS variables, Tailwind colours, JSON or a plain HEX list, or download it as a PNG.

## How to use it

1. Drop an image (PNG, JPG, WebP, GIF or SVG).
2. Choose how many colours you want (3 to 12) and the order: most used, light to dark, or by hue.
3. Click a colour card to copy its HEX code, or click the picture to pick any colour from it.
4. Choose a code format and click Copy code, or download the palette as a PNG.

Tip: For a brand palette from a logo, ask for 3–5 colours; for a photo's mood, 6–8. More colours than that usually gives you near-copies of the same shade.

## How the colours are found

The picture is shrunk to at most 240 px and every pixel is grouped with similar ones. The biggest groups that are clearly different from each other are the starting colours, then k-means clustering refines them in eight rounds until each colour sits at the centre of its group. Fully or mostly transparent pixels are ignored, so a logo's transparent background doesn't become a colour. The percentage is how much of the picture each colour covers, so big plain areas (a white background, a blue sky) rank high.

Because each colour is the average of its group, it may not be any single pixel's exact value. When you need an exact colour from one spot, such as a logo's red, click that spot on the picture instead.

## HEX, RGB and HSL

- **HEX**: #1e90ff: red, green and blue as two hexadecimal digits each. The usual format in CSS, Figma and most design tools.
- **RGB**: rgb(30, 144, 255): the same three values from 0 to 255.
- **HSL**: hsl(210, 100%, 56%): hue (position on the colour wheel, 0–360), saturation and lightness. The easiest format for making lighter or darker versions of a colour: change only the last number.

## Readable text on each colour

Each card shows “Aa” in black or white, whichever is easier to read on that colour, with its WCAG contrast ratio. A ratio of 4.5:1 or more passes the AA standard for normal text, 3:1 is enough for large headings and buttons, and 7:1 passes AAA. If a brand colour only reaches 3:1, use it for big headings, icons and backgrounds behind white text that is large and bold, not for body text.

## The code formats

- **CSS variables**: :root { --color-1: #…; } — use them as var(--color-1) anywhere in your stylesheet.
- **SCSS variables**: $color-1: #…; for Sass projects.
- **Tailwind colours**: A palette object with 100, 200, 300… keys to paste into theme.extend.colors in tailwind.config.js. Rename palette to your brand name.
- **JSON**: Each colour's HEX, RGB, HSL and share, for scripts and design tokens.
- **HEX list**: #…, #…, #… to paste into Coolors, Figma or a style guide.

## Example

A designer drops a beach photo and asks for six colours ordered light to dark: sand #e8d9bd, foam #f4f6f4, sea #3f8fa8, deep water #1f5a73, sky #9cc7dc and rock #5b4b3e. The sea colour shows white text at 3.6:1, good for big headings; deep water reaches 7.4:1, fine for body text. They copy the palette as CSS variables into the site's stylesheet, and click the photo's orange towel to add an accent colour.

## Turning the colours into a design palette

A few colours from a picture are a starting point, not a finished palette. A common approach is the 60-30-10 rule: one calm colour for about 60% of the design (backgrounds), a second for about 30% (cards, sections, navigation) and a strong accent for the last 10% (buttons, links, highlights). Sort the palette Light to dark: the lightest colours are natural backgrounds, the darkest work for text, and the most saturated middle colour is usually the accent.

For buttons and hover states you need shades of the accent. Keep its hue and saturation and change only the lightness in HSL, for example 56% for the button, 48% for hover and 92% for a soft background tint. Then check every text and background pair with the contrast ratio on the cards, since a colour that looks bold can still be hard to read.

## Tips

- **Screenshots of websites**: Take a screenshot of a site you like and drop it in to see its colour scheme.
- **Remove the background first**: If a big background dominates the palette, crop the picture to the subject first.
- **Picked colours**: Colours you click are added to the palette and to the copied code (up to six).
- **Turn colours into shades**: Paste a HEX code into the Colour Converter to get its HSL value and make lighter and darker shades.

## Questions

### How do I get the HEX code of a colour in an image?

Drop the image and click the spot on it; the HEX code is copied and added to the palette.

### Why is a colour I see missing?

Small details cover few pixels. Ask for more colours, crop the picture, or click the detail to pick it.

### Why are two colours almost the same?

The picture has two large areas of similar shades. Ask for fewer colours to merge them.

### Can I use it for a logo with a transparent background?

Yes. Transparent pixels are ignored, so only the logo's colours are counted.

### Does it work with SVG?

Yes, SVGs are drawn first and then read like any other picture.

### Are my pictures uploaded?

No. Everything happens in your browser, on your device. Nothing is sent to a server or stored, so private photos and unreleased designs stay private.

## Related

- [Colour Converter](https://cromagnon.app/tools/color-converter)
- [Favicon Generator](https://cromagnon.app/tools/favicon-generator)
- [Image Compressor](https://cromagnon.app/tools/image-compressor)
- [Image to Base64](https://cromagnon.app/tools/image-to-base64)
- [All tools](https://cromagnon.app/tools)
