How to use the palette extractor
- Choose an image or drop it on the box: PNG, JPEG, WebP, GIF, AVIF or SVG.
- Set the number of colors. Five or six is a good start for a brand or interface palette.
- Choose the order: most common first, or light to dark.
- Copy individual hex codes from the swatches, or set a name prefix and export the whole palette.
- Read the contrast check before using any pair for text.
Use the sample image analyses a built-in sunset illustration, so you can see how the tool behaves before choosing your own image.
How it works
- Downscaling. The image is drawn at most 200 pixels on its longest side. Fine detail doesn’t change the main colors, and fewer pixels keeps the analysis fast.
- Sampling. Up to 12,000 pixels are used, and pixels that are more than half transparent are skipped, so logos on transparent backgrounds give their real colors.
- Clustering. Pixels are converted to OKLab and grouped with k-means: starting points are spread out with the k-means++ method, then each group’s centre is refined until it stops moving. A fixed seed makes the result the same every time for the same image.
- Reporting. Each swatch is the average sRGB color of its group, with its share of the sampled pixels. Text on each swatch is set to black or white, whichever contrasts more.
Worked examples
Example 1: a brand palette from a logo
Choose your logo with a transparent background and set the count to the number of colors in the logo. The swatches match the logo’s colors, because transparent pixels don’t create a “background” color. Export as CSS variables named after your brand.
Example 2: a website theme from a hero photo
Choose a landscape photo and extract six colors. Sort light to dark: the lightest swatch can be a background, the darkest a text color, and a saturated mid-tone an accent. Check the contrast list to see which pairs work for text.
Example 3: matching an illustration
Extract eight colors from an illustration to build charts or icons in the same style. The share percentages show which colors dominate, which helps you keep the same balance.
Tips for better palettes
- Crop first. Large areas of sky or background dominate the result; cropping to the subject gives more interesting colors.
- Ask for more colors than you need, then pick the best ones. Similar shades are easy to drop.
- Adjust for accessibility. Darken or lighten a swatch slightly with the color converter to reach the contrast you need.
Common mistakes
- Using mid-tone photo colors for text, which usually fails contrast.
- Expecting exact brand colors from a JPEG photo. Compression and lighting shift colors; use official hex codes for brand work.
- Too few colors for busy images, which averages distinct colors into muddy ones.
- Ignoring dark mode. A palette taken from a bright image may need darker variants.