Skip to content
Jellykit

Palette From Image

Turn a photo into a ready-to-paste palette of its five main colors as CSS variables, Sass, a Tailwind theme or JSON, ordered light to dark.

  • Runs on your device
  • Works in the background
Loading tool

About Palette From Image

Starting a design from a photograph, a mood board or a client logo? Drop the picture here and its five main colors come back as CSS custom properties, ordered from light to dark, ready to paste into a stylesheet.

Change the export to Sass variables, a Tailwind v4 theme block, a Tailwind v3 config or JSON, rename the variables, or ask for anything from two to sixteen colors. Each swatch also shows its share of the picture, so you can tell a background color from an accent.

How it works

  1. Your browser decodes the picture, and a copy is reduced to at most 250,000 pixels by picking pixels rather than blending them, so every color counted is one that is really in the image.
  2. Pixels that are more than half transparent are skipped; up to 100,000 of the rest are sampled evenly across the picture.
  3. Median cut splits the sampled pixels into groups along the color channel that varies most. The refined method then moves each color to the center of the pixels nearest to it until nothing changes, which gives truer averages.
  4. Each color is the average of its group, and its share is the size of that group out of all sampled pixels. Everything runs in a background worker on your device.

Questions

What do the exported variables look like?

With the name "palette" the CSS export is a :root block of --palette-1 to --palette-5, in the order shown. The Tailwind v4 export uses --color-palette-1 and so on inside @theme, which gives you classes such as bg-palette-1.

Why are the colors ordered light to dark?

A light-to-dark order maps naturally onto backgrounds, surfaces and text. Switch the order to "Most used first" to number the colors by how much of the picture they cover, or "By hue" to group them around the color wheel.

Will the palette have enough contrast for text?

Not necessarily: a photo can be all mid-tones. Check any pair you plan to use for text and background with a contrast checker before you ship it.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.