UI Palette Previewer
Apply a palette to a live component kit and audit contrast before committing to it.
Palette & roles
7 colors · 4 contrast failures| Role | Color (override) |
|---|---|
| bg | |
| surface | |
| text | |
| muted | |
| primary | |
| accent | |
| border | |
| success | |
| warn | |
| error | |
| info |
Live UI & audit
4 failing pairsQuarterly overview
Revenue
$48,290
Up 12% from last quarter
| Report | Status |
|---|---|
| March summary | Ready |
Save complete — your changes are live.
Trial ends in three days.
Payment could not be processed.
A new dashboard layout is available.
Modal surfaces use the same role colors as cards.
| Pair | Ratio | Level |
|---|---|---|
| 17.06:1 | AAA | |
| 14.48:1 | AAA | |
| 1.74:1 | Fail | |
| 9.80:1 | AAA | |
| 17.06:1 | AAA | |
| 17.06:1 | AAA | |
| 9.80:1 | AAA | |
| 1.74:1 | Fail | |
| 2.67:1 | Fail | |
| 1.00:1 | Fail |
Examples
Ocean demo palette
#F8FAFC #E2E8F0 #94A3B8 #0F172A #2563EB #38BDF8 #16A34Abg #F8FAFC · text #0F172A · primary #2563EBLuminance endpoints fill background and text; the saturated mid-tone becomes the action color.
Failing button label
Primary set to a pale yellow, button text chosen automaticallyAudit chip: 1.9:1 — Fail, highlight buttonThe kit chooses black or white text by contrast, and the audit still reports weak combinations.
Hand-off block
Final role map: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
Provide a palette
Paste hex, #rgba, rgb() or rgba() colors with any separator, load a demo, or extract colors from a local image.
Inspect the kit
See the palette applied to navigation, cards, forms, a table, alerts and a chart in both light and dark mode.
Fix contrast
Read the audit table, click a failing pair to highlight its component, and override that role until the ratio passes.
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
| Form | Notes |
|---|---|
| #rgb / #rrggbb | Expanded and normalized to uppercase hex |
| #rgba / #rrggbbaa | Alpha composited over white before role assignment and contrast math |
| rgb() / rgba() | Channels clamped to 0–255; alpha handled like hex alpha |
| Image file | Downscaled 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
Related tools
CIELAB Color Explorer
Convert colors to CIELAB/LCh and XYZ, explore a*–b* and L*–C* slices, and compare colors with ΔE76 and ΔE2000.
CMYK Color Converter
Convert hex/RGB to CMYK percentages and back with total ink limits, rich-black recipes, batch conversion and a print preview.
Color Blindness Simulator
Simulate color blindness on palettes and images. Compare protanopia, deuteranopia, tritanopia, and more side-by-side.
Color Contrast Checker
Advanced WCAG accessibility compliance checker with color blindness simulation, multiple text sizes, and comprehensive analysis features.
Color Converter
Convert colors between multiple formats (HEX, RGB, HSL, HSV, CMYK, LAB) with color blindness simulation, named colors, and batch processing
Color Extractor
Extract colors from uploaded images by hovering over pixels to get precise color values.