How to Create a Color Palette From a Photo
Updated · 2 min read
Some of the best color schemes come from photographs: a sunset, a market stall, a forest in autumn. Nature has already balanced the colors for you. Here is a practical workflow to turn a photo into a palette you can actually use on a website, a presentation or a brand.
Step 1: extract the dominant colors
- Open Palette from Image and drop in your photo.
- Start with 6 colors. For logos and flat illustrations use 3-4; for busy photos try 8-10 to capture accents.
- Sort by Most common first to see which colors dominate, or Light to dark to spot good background and text candidates.
Under the hood, the tool uses k-means clustering: it groups similar pixels and averages each group. The percentage next to each swatch tells you how much of the image that color covers.
Step 2: assign roles with the 60-30-10 rule
A palette is more than a list of colors; each one needs a job. A classic interior-design rule works well on screens too:
- 60% - dominant: backgrounds and large surfaces. Usually the lightest (or, for dark themes, the darkest) muted color from the photo.
- 30% - secondary: cards, sections, navigation. A mid-tone that pairs with the dominant color.
- 10% - accent: buttons, links, highlights. The most saturated color in the palette, often a small area of the photo.
Don't be surprised if your accent is a color that covers only 3% of the photo. Small, vivid areas make the best accents.
Step 3: fix readability
Colors pulled from photos are often mid-tones, which are pleasant to look at but poor for text. Check every text/background pair:
- Body text needs a contrast ratio of at least 4.5:1 against its background.
- If a color fails, keep its hue but make it darker or lighter. The color converter shows tints and shades of any code, each with its contrast.
Read more in our guide to color contrast.
Step 4: export and use it
The palette tool exports the result as:
- CSS variables, e.g.
--color-1: #292D44;, to paste into your stylesheet; - SCSS variables and JSON for design tokens;
- Tailwind colors for
tailwind.config.js(see adding custom colors to Tailwind); - PNG, a palette image to share with clients or put in a mood board.
Want a background with personality? Feed two or three palette colors into the gradient generator.
Tips for better photo palettes
- Crop first. If you only care about the subject, crop the background away before extracting.
- Watch out for shadows. Dark, desaturated clusters often come from shadows. They can be useful as text colors, but rarely as accents.
- Try several photos from the same shoot and keep the colors that repeat; that is the true character of the scene.
- Mind the context. A palette taken from a photo will always look great next to that photo, so it's a reliable way to design a page around a hero image.