DevTools Logo

UI Palette Previewer

UI Palette Previewer

Apply a palette to a live component kit and audit contrast before committing to it.

Runs in your browser

Palette & roles

7 colors · 4 contrast failures
Semantic role mapping
RoleColor (override)
bg
surface
text
muted
primary
accent
border
success
warn
error
info

Live UI & audit

4 failing pairs
Palette applied — 4 contrast failures. Click a failing pair to highlight its component.

Quarterly overview

Revenue

$48,290

Up 12% from last quarter

New
Visitors12%
Signups34%
Retention56%
Sample report table
ReportStatus
March summaryReady

Save complete — your changes are live.

Trial ends in three days.

Payment could not be processed.

A new dashboard layout is available.

Dialog title

Modal surfaces use the same role colors as cards.

Contrast audit
PairRatioLevel
17.06:1AAA
14.48:1AAA
1.74:1Fail
9.80:1AAA
17.06:1AAA
17.06:1AAA
9.80:1AAA
1.74:1Fail
2.67:1Fail
1.00:1Fail

Examples

Ocean demo palette

Input
#F8FAFC #E2E8F0 #94A3B8 #0F172A #2563EB #38BDF8 #16A34A
Output
bg #F8FAFC · text #0F172A · primary #2563EB

Luminance endpoints fill background and text; the saturated mid-tone becomes the action color.

Failing button label

Input
Primary set to a pale yellow, button text chosen automatically
Output
Audit chip: 1.9:1 — Fail, highlight button

The kit chooses black or white text by contrast, and the audit still reports weak combinations.

Hand-off block

Input
Final role map
Output
:root { --color-bg: #f8fafc; --color-primary: #2563eb; … }

CSS variables carry the exact role values shown in the preview into your stylesheet.

About this tool

UI Palette Previewer applies a palette to a realistic component kit — navigation, hero card, stat cards, a form, a table, badges, alerts, a bar chart and a dialog — so colors can be judged in context rather than as isolated swatches. Paste hex codes in any separator, load a demo palette, or extract dominant colors from an image with local median-cut quantization.

Role auto-assignment uses WCAG relative luminance and chroma: the lightest color becomes the background, the darkest becomes text, the mid-luminance high-chroma color becomes the primary action, and hue proximity picks success, warning, error and info accents. Every role can be overridden from the pasted colors with one selection. Dark mode re-maps the luminance endpoints and clears manual overrides so the new mapping is visible.

The contrast audit evaluates ten real text/background pairs with published WCAG 2.1 formulas, showing ratios and AA, AA-large or AAA status. Clicking a pair highlights the corresponding component. The final role map exports as a :root block of CSS custom properties, ready to paste into a theme file. Nothing is uploaded: image decoding, extraction and contrast math all run in the browser, and the audit is guidance rather than a compliance certificate.

What this tool does not do

  • Contrast results are AA/AAA guidance for text pairs, not a full accessibility audit.
  • Role heuristics are a useful starting point; manual overrides are expected for unusual palettes.
  • Image extraction quantizes a downscaled sample, so tiny watermark colors may not appear.
  • The kit is one fixed dashboard-style layout; there is no multi-screen theme editor here.

How to use this tool

  1. Provide a palette

    Paste hex, #rgba, rgb() or rgba() colors with any separator, load a demo, or extract colors from a local image.

  2. Inspect the kit

    See the palette applied to navigation, cards, forms, a table, alerts and a chart in both light and dark mode.

  3. Fix contrast

    Read the audit table, click a failing pair to highlight its component, and override that role until the ratio passes.

  4. Export variables

    Copy or download the generated :root CSS custom properties for your design system.

Use cases

Palette selection

Compare two candidate palettes inside the same component kit before committing to a design system.

Theme review

Preview a new brand palette across buttons, alerts and forms, then hand off the CSS variables.

Accessibility triage

Find text pairs below AA in a realistic layout and test role swaps until they pass.

Accepted color inputs

FormNotes
#rgb / #rrggbbExpanded and normalized to uppercase hex
#rgba / #rrggbbaaAlpha composited over white before role assignment and contrast math
rgb() / rgba()Channels clamped to 0–255; alpha handled like hex alpha
Image fileDownscaled to at most 512px and quantized with median cut to 3–12 colors

Invalid tokens are listed by position; valid colors remain usable.

Common mistakes

Mistake:Judging a color only by its swatch.

Fix:Check it in the kit: the same hue can work as a button fill and fail as small body text.

Mistake:Treating the audit as certification.

Fix:Ratios follow WCAG 2.1 math, but real compliance depends on font size, weight, zoom and content.

Mistake:Expecting uploaded images to leave the tab.

Fix:Extraction is a local canvas operation; there is no upload endpoint.

Mistake:Keeping manual overrides after switching to dark mode.

Fix:Dark mode clears overrides so the luminance-based mapping can be re-evaluated.

Frequently asked questions

How does role auto-assignment work?

Colors are sorted by WCAG relative luminance. The lightest becomes the background, the darkest the text, the second lightest the surface, and the highest-chroma color in the mid-luminance band becomes the primary action. Success, warning, error and info colors are matched by hue proximity, with hue-rotated fallbacks.

Which contrast ratios does it flag?

Ten text/background pairs in the sample kit are scored with published WCAG 2.1 formulas. Ratios of 7:1 (4.5:1 for large text) are AAA, 4.5:1 is AA, 3:1 is AA Large, and anything lower fails. Click a chip to highlight its component.

Can I use colors from a screenshot?

Yes. Choose Extract from image and pick a local file. It is downscaled to at most 512 pixels, sampled into a 5-bit-per-channel histogram and quantized by median cut into 3–12 dominant colors. The image never leaves your browser.

Does dark mode re-map roles?

Yes. It swaps the luminance endpoints so the formerly lightest color becomes text and the formerly darkest becomes the background, then reassigns the remaining roles. Manual overrides are cleared so you see the new automatic mapping.

How do I export CSS variables?

The output panel shows a :root block with one --color-* property per semantic role. Copy it or download palette.css and paste it into your theme stylesheet.

Does this certify accessibility compliance?

No. It follows the published ratio math and flags likely text-contrast failures in a representative component kit, but compliance also depends on font size, weight, zoom, language and the real content of your site.

References & standards