Extract Brand Color Palettes & Pass WCAG Contrast Checks (Without Guesswork)
Pulling 6 pretty HEX swatches out of a moodboard or competitor screenshot takes five seconds. Turning those colors into accessible light/dark UI components, WCAG-compliant buttons, and clean CSS variables is where teams usually improvise blindly.

Core Design-to-Code Principle
Treat dominant extracted colors as raw inspiration, verify every foreground/background pairing against WCAG relative luminance (4.5:1 minimum for body text), sample tiny UI accents via eyedropper, and ship semantic :root CSS custom properties or Tailwind config tokens instead of brittle HEX literals.
1. Area Extraction vs. Eyedropper Sampling: Why You Need Both
Automatic palette generators scan pixel frequencies and group nearby shades into clusters. That instantly surfaces canvas backgrounds, photography moods, and primary surfaces—but struggles when an important interactive CTA or logo underline only occupies 1% of the frame.
By pairing 4–12 swatch extraction with a click-to-sample eyedropper right on the preview image, you pull global surfaces automatically and pinpoint hairline accent colors manually in one workspace—seeing exact HEX, RGB, and HSL readouts on click.
2. WCAG Contrast Cheat Sheet (What the Ratios Actually Require)
| WCAG Level | Contrast Threshold | Applies To | Practical UI Guidance |
|---|---|---|---|
| AAA (Enhanced) | >= 7.0 : 1 | Normal body copy under strict compliance | Best for documentation, long-form articles, healthcare, and dark mode slate copy. |
| AA (Standard Pass) | >= 4.5 : 1 | Standard text (< 18pt / < 14pt bold) | Baseline accessibility target for buttons, badges, inputs, and captions. |
| AA Large Only | 3.0 : 1 – 4.49 : 1 | Headings (>= 24px or >= 19px bold) & UI icons | Safe for borders, focus rings, or big hero headlines—never for 14px paragraphs. |
| Fail | < 3.0 : 1 | Decorative dividers only | Darken pastel yellows/cyans in light mode—or brighten navy hues in dark mode. |
Pro tip: Always check every swatch against both white (#FFFFFF) and deep dark slate (#0F172A) surfaces—many vibrant sky blues pass dark-mode readability effortlessly while failing white-button text!
3. From Swatches to Production Code in One Click
Instead of copying six individual HEX codes by hand, export the whole palette straight into your workflow format:
CSS Variables & Tailwind Config
Paste --color-brand-* tokens into globals.css or drop the ready-made theme.extend.colors snippet directly into Tailwind.
JSON Tokens & SVG Swatch Cards
Export structured JSON for design-token pipelines, or download a crisp vector .svg swatch board to paste into Figma, Pitch decks, or brand guidelines.
:root {
/* 60% Dominant Surface & Text (15.4:1 AAA Contrast) */
--surface-primary: #F8FAFC;
--text-primary: #0F172A;
/* 30% Secondary Card & Muted Copy (7.2:1 AAA Contrast) */
--surface-card: #FFFFFF;
--text-muted: #334155;
/* 10% Brand Accent — Darkened to #047857 for White Button Text (5.4:1 AA Pass) */
--brand-accent: #047857;
--brand-on-accent: #FFFFFF;
}4. Why Relative Luminance Beats Eyeballing (And the 60-30-10 UI Rule)
When you extract 6 dominant swatches from a photograph or brand logo, applying all 6 in equal measure creates visual chaos. Production design systems map extracted swatches using the 60-30-10 proportion rule paired with the W3C relative luminance equation (L = 0.2126×R + 0.7152×G + 0.0722×B):
Green & Yellow Trap on White Text
Because green contributes 71.5% of perceived luminance, bright emerald (#10B981) or amber (#F59E0B) buttons with white text only reach 2.2:1–2.8:1 contrast. Either switch button text to dark slate (#0F172A) or deepen the button fill to #047857.
60% Neutral Canvas + 30% Structure
Assign your lightest or darkest extracted swatch to 60% page background, your mid-tone slate/warm neutral to 30% card borders and secondary containers, and reserve your vibrant brand hue for the 10% primary CTA and active states.
Test Both Light & Dark Polarity
A saturated royal blue (#2563EB) passes 4.5:1 against a white card in light mode, but vibrates painfully at 2.9:1 against a #0F172A dark-mode card—desaturate and lighten it to #60A5FA for dark mode.
Extract, Audit Contrast & Build Vector Assets Locally
Run your logo, UI mockup, or product photography through our zero-upload Color Palette Extractor—then build clean SVG graphics with your verified brand tokens.