Why check a whole palette instead of one pair at a time
Most interface accessibility bugs do not appear on the primary headline. They slip into muted captions, secondary pills, hover states, badge labels, and tinted alert banners where two brand colors unexpectedly meet on the same surface. Checking a single foreground and background pair gives a narrow snapshot, while a full palette matrix exposes every valid and failing combination across your system at once.
This color contrast checker combines a classic WCAG 2.1 pair inspector with an interactive N-by-N contrast matrix loaded directly from real UINice design systems. Every cell displays the exact numeric ratio and its compliance grade, so designers and front-end engineers can click straight onto a weak pair, preview how small and large typography reads on that background, and adjust lightness until the combination passes cleanly.
Everything runs locally inside your browser using standard sRGB relative luminance formulas. There is no account wall, no plugin installation, and no server round-trip when you test private brand guidelines before launch.
How to audit and fix color contrast in four steps
- Pick a starting palette from the curated UINice design system presets or enter your own foreground and background hex values directly in the control panel.
- Read the live contrast ratio at the top of the preview card alongside the four pass badges covering Normal Text AA (4.5:1), Normal Text AAA (7:1), Large Text AA (3:1), and Non-Text UI components (3:1).
- Scan the whole-palette matrix below the card to spot every pair that passes or fails across your background, surface, foreground, muted, primary, and accent tokens. Click any matrix cell to load that exact pair into the inspector.
- When a color falls short of your accessibility target, click Fix to AA or Fix to AAA to shift only the foreground lightness while preserving the original hue and saturation, then copy the verified CSS variables straight into your stylesheet.
Understanding WCAG 2.1 contrast thresholds for real products
Web Content Accessibility Guidelines define contrast ratio on a scale from 1:1 for identical colors up to 21:1 for pure black on pure white. Because human vision responds non-linearly to light, WCAG first linearizes each red, green, and blue channel before weighting green highest at 0.7152, red at 0.2126, and blue at 0.0722. That explains why saturated pure blue feels darker on white than bright yellow does, even when both sit at similar HSL lightness values.
For everyday product design, knowing which threshold applies to each element prevents unnecessary compromises while keeping critical text effortless to read:
- 4.5:1 (Level AA Normal Text): Required for standard body paragraphs, form labels, navigation links, table cells, and buttons smaller than 18pt regular or 14pt bold.
- 7:1 (Level AAA Enhanced Text): Ideal for long-form editorial pages, documentation portals, financial dashboards, and products serving readers with low vision.
- 3:1 (Level AA Large Text & UI Components): Applies to headings at least 24px regular or 18.67px bold, as well as icons, input borders, focus outlines, toggle tracks, and chart bars that carry meaning.
- Decorative elements and disabled controls are exempt from strict ratios, yet keeping disabled labels near 2.5:1 to 3:1 helps users recognize inactive actions without squinting.
Keeping brand identity intact while raising contrast
A frequent complaint from brand teams is that accessibility fixes flatten vibrant accent colors into muddy browns or dull grays. The secret to avoiding that trap is separating decorative fills from text roles. Keep your signature bright coral, lime, or amber for icons, subtle highlights, progress fills, and large display badges, while reserving a slightly deeper shade from the same hue family for text links and primary button backgrounds with white labels.
The built-in auto-fix helper searches along your chosen hue and saturation curve to find the closest lightness step that clears 4.5:1 or 7:1. Instead of snapping blindly to black or white, it preserves the character of your brand hue so the adjusted token still belongs naturally to the same palette.
Another reliable tactic is pairing a dark ink label with a vibrant light-medium primary fill rather than forcing white text onto bright yellow, cyan, or mint buttons. Clicking Swap lets you test both foreground directions immediately and confirm which polarity reads cleaner.
Practical accessibility habits for design systems and handoff
Accessibility works reliably when contrast rules live inside semantic tokens rather than ad-hoc hex codes scattered across components. Once you verify a pair in the matrix, map it to explicit roles such as surface, foreground, muted text, primary action, and primary foreground. That way engineers never guess whether a muted gray is safe on a tinted card surface.
Testing both light and dark modes matters equally. A soft slate gray that passes 4.6:1 on crisp white will drop below 3:1 if reused unchanged on a slightly tinted off-white card. Reviewing the full matrix catches those subtle surface shifts before pull requests reach QA or external accessibility audits.
- Always test muted helper text and placeholder text on the exact card surface they sit on, not just the page canvas.
- Check button labels in default, hover, and active states so darkening or lightening on hover never dips under 4.5:1.
- Verify focus rings and input borders against both inner fill and outer page background to satisfy 3:1 non-text contrast.
- Document approved token pairs next to your color variables so new features reuse verified combinations by default.
From color contrast check to a complete design system
Passing contrast ratios is the foundation of a trustworthy interface, yet typography hierarchy, spacing rhythm, border radius, and surface contrast all work together to make a page feel calm and coherent. Every preset swatch in this checker links straight to its matching UINice design system reference, where you can inspect complete components, layout spacing, and dark-mode behavior built from the same color tokens.
Whether you are auditing an existing web app, refining a brand refresh, or assembling a new token sheet from scratch, running your entire palette through this matrix takes seconds and gives you clean CSS variables ready to commit.
Questions
How is WCAG 2.1 color contrast ratio calculated?
Each hex color is converted from sRGB to linear light values to compute its relative luminance L between 0 and 1. The ratio equals (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color and L2 is the darker color, yielding a value between 1:1 and 21:1.
What is the difference between WCAG AA and AAA contrast?
Level AA requires 4.5:1 for normal body text and 3:1 for large text or graphical UI controls, and is the standard target for most commercial websites and apps. Level AAA raises those targets to 7:1 for normal text and 4.5:1 for large text for enhanced readability.
Does the one-click Fix button change my brand hue?
No. Fix to AA and Fix to AAA keep your foreground hue and saturation steady while stepping lightness darker or lighter until the exact WCAG threshold is met, selecting the closest passing shade to your original color.
Can I audit private brand colors safely in this checker?
Yes. All luminance math, matrix calculations, and CSS variable exports run 100% locally in your browser without uploading hex values or palette data to any server.