How to build a brand color palette from a single image
From one photo to a usable palette: picking the dominant color, checking accessible contrast, and exporting it to CSS or Tailwind.
Building a brand palette from an image means grouping its pixels into a handful of dominant colors and turning those groups into hex codes you can actually use. The color palette extractordoes exactly that in your browser: drop in a photo or a logo and get 5 to 8 dominant colors back in seconds, without the file ever leaving your machine. The hard part isn't pulling the colors out — any extractor does that — it's turning five loose hex codes into a palette that actually works on a real page: colors with defined roles and enough contrast that the text stays readable.
What a color extractor is actually doing
An extractor has no idea what a logo is or which color is "yours." It reads every pixel, plots it as a point in color space, and groups nearby points together — usually with a k-means-style clustering algorithm. Each cluster collapses into one representative color (typically its center), and clusters get ranked by how many pixels they cover. What you get back is the colors that take up the most area in the image, not the colors a person would call important.
Why the most common color is rarely your brand color
This trips people up constantly: the color with the most pixels is usually the background, a shadow gray, or a skin tone or sky — not the vivid color that made you screenshot the photo in the first place. A small logo on a large white background almost always loses on raw pixel count. The fix is simple: extract more colors than you think you need (7 or 8 instead of 3 or 4) and pick the actual brand color by eye, instead of trusting whatever lands first on the list.
Turning 5 extracted colors into a palette with real roles
A flat list of hex codes isn't a palette — a working palette assigns each color a job. At minimum you need four roles: primary (your brand color, for buttons and strong accents), accent (a second color that draws attention without competing with primary), surface (the background for cards and sections, almost always a near-white or near-black neutral), and text (body copy color, almost always a dark gray rather than pure black). Out of 5 to 8 extracted colors, rarely more than two deserve to be primary or accent — the rest are usually surface candidates, or just noise from reflections and shadows in the photo.
The contrast problem — this isn't a taste call
A color can be gorgeous and completely unreadable as text. Before you assign an extracted hex to a text role or a button background, check its contrast ratio against whatever sits behind it: WCAG requires a minimum of 4.5:1 for normal text, and 3:1for large text (headings) or UI components. A forest green pulled from a logo might work great as an accent on white and still fail outright as text on that same white if it's too light. This check isn't optional and it isn't about taste — it's the difference between a site people can actually read and one they can't.
Why HSL or OKLCH beats eyeballing hex codes
When you need a lighter or darker variant of your primary color for a hover state or a disabled button, nudging hex digits by hand produces inconsistent results — two colors with the same "visual" lightness difference can end up with wildly different hex values. HSL fixes this by separating hue (H) from saturation (S) and lightness (L): adjust only L and you get variants that keep the same hue. OKLCH goes further and fixes a real gap in HSL — its lightness doesn't actually match how the human eye perceives brightness, so two HSL colors with the same L can look noticeably different in brightness. OKLCH's lightness axis tracks perceived brightness much more closely, so light and dark variants stay consistent across different hues. Convert any extracted hex to HSL or OKLCH — and back — with the color converter.
Exporting the palette to CSS or Tailwind
Once the roles are settled, the last step is to stop copy-pasting hex codes by hand. The palette extractor exports straight to CSS custom properties (--color-primary: #...) ready to paste into your stylesheet, or to the colors block of a Tailwind config, so you can use classes like bg-primary or text-accent without repeating a hex code anywhere. Centralizing colors this way also makes it trivial to retune the whole palette later — you change the value in one place. And if all you actually need is a favicon in your primary color, you don't have to build a full palette first: the favicon generator takes a color or an image and produces every size at once.
What an extracted palette doesn't solve
Be honest about the limits before you build on top of this. An extracted palette is a starting point, not a brand identity — it says nothing about typography, logo design, or the rest of what makes a brand recognizable. And color is photo-dependent: lighting, white balance, and the file's color profile all shift the resulting hex, so two photos of the same object taken under different conditions will hand you slightly different colors. If the source is a logo or any vector graphic, start from the original file (SVG, PDF) rather than a phone photo whenever you can. If your source image is in an unusual format — HEIC off an iPhone, a WebP screenshot — convert it first with the image converterso the extractor isn't reading compression artifacts.
Frequently asked questions
How many colors should I extract from an image to get a usable palette?
Pull more than you need — six to eight — then hand-pick the two or three that actually represent your brand. The most frequent color is rarely the right one, so starting with a wide list gives you room to discard backgrounds, shadows, and noise.
Why do two photos of the same logo give me different hex codes?
Because the hex depends on lighting, white balance, and the file's color profile, not just the object's real color. If you need an exact, stable color, start from the original vector file (SVG, PDF) instead of a photo.
What contrast ratio do I need for readable text?
WCAG requires a minimum of 4.5:1 between text and its background for normal text, and 3:1 for large text (24px and up, or 19px bold) and UI components. A pretty extracted color doesn't guarantee that ratio — you have to check it before using it as text.
HSL or OKLCH: which is better for generating light and dark variants?
OKLCH gives more consistent results because its lightness value tracks how the eye actually perceives brightness; two OKLCH colors with the same L look equally light, which HSL doesn't guarantee. For everyday use HSL is plenty; for palettes spanning many hues, OKLCH avoids the inconsistencies.
Can I extract a palette from a transparent PNG logo?
Yes — the extractor ignores fully transparent pixels and works only with the visible color. Semi-transparent edges from antialiasing can show up as stray in-between colors in the results, another reason to extract more colors than you plan to use.
How do I export the palette to a Tailwind config?
The palette extractor generates the colors block in Tailwind format directly, ready to paste into the colors section of your config — you just map each role name (primary, accent, surface...) to its hex value.
Extract your color palette now
Upload a photo or a logo and export to CSS or Tailwind. Free, local, no limits.
Open palette extractor →Related tools
- Extract color palette — Dominant colors from an image, exportable to CSS or Tailwind.
- Convert colors — HEX, RGB, HSL and OKLCH, for generating consistent variants.
- Convert image — Turn HEIC, WebP or AVIF into PNG or JPG before extracting.
- Generate favicon — Every size, from a single color or image.
You might also like: how to convert HEIC to JPG and the best developer tools in 2026.