Testing a Whole Colour Palette for Contrast with WCAG 2.2 and APCA
Check every text and background pair of a design-system palette at once, compare WCAG 2.2 ratios with APCA Lc, fix failing colours and export safe pairs.

A design system rarely fails accessibility because of one bad colour. It fails because nobody checked which combinations work. With nine colours there are 72 possible text and background pairs, and every new page picks a different one. A contrast matrix answers the question for all of them at once. This guide explains the two scoring methods, how to read a matrix and how to fix failing pairs with the Accessibility Colour Contrast Matrix.
Two ways to measure contrast
WCAG 2.2 uses a contrast ratio between 1:1 and 21:1, calculated from the relative luminance of both colours. The thresholds are:
- 4.5:1 for normal text (level AA)
- 3:1 for large text, meaning at least 24 px regular or about 18.66 px bold (AA)
- 7:1 for normal text at level AAA
- 3:1 for non-text elements such as input borders, focus rings and icons
APCA, the Accessible Perceptual Contrast Algorithm, is a newer model being developed for future WCAG versions. It reports a lightness contrast value, Lc, which is positive for dark text on light backgrounds and negative for light text on dark. Roughly, Lc 90 suits small body text, Lc 75 normal body text, Lc 60 content text at 24 px or 16 px bold, Lc 45 headlines, and Lc 30 placeholders and disabled text.
The two methods often disagree on mid-tone colours. WCAG tends to underrate white text on orange or bright blue and overrate some dark combinations. For legal conformance today, WCAG 2.2 is the standard; APCA is a useful second opinion, especially for dark themes.
Building your palette
Start from the sample or replace it. You can edit swatches one by one, or paste a palette in almost any form: CSS custom properties, lines like Ink #111827, a design-tokens JSON file or just a list of hex codes. rgb() and hsl() values are converted. Every change can be undone.
Reading the matrix
Rows are text colours and columns are backgrounds, so each cell shows a real use: this text on that background. Choose what the cells display (the WCAG ratio, the APCA Lc or both) and choose the pass rule your team follows. With fade failing pairs on, the usable combinations stand out at a glance. Tap a cell to open the detail panel with 14 px text, bold large text, a heading and a bordered UI shape in that pair, plus both scores and the APCA guidance.
Fixing a failing pair
Below the preview, the tool searches for the nearest lightness of the text colour that reaches 4.5:1, 7:1 and 3:1 on that background while keeping its hue and saturation. Apply a suggestion to replace the swatch in the palette; the whole matrix updates, and undo brings the old colour back if the new shade does not fit the brand.
A worked example
In the sample palette, Gray 500 #6b7280 on white reaches 4.83:1, a narrow AA pass with an APCA Lc of 73.6. Brand blue on white passes at 5.17:1. Warning amber #f59e0b on white fails at 2.15:1; the suggested text shade #a56a07 reaches 4.5:1. White on success green gets only 3.30:1, fine for large button labels but not for body text, while dark ink on amber reaches 8.26:1. The team decides that warning banners use dark text on amber, never amber text on white.
Turning results into documentation
The safe-pairs list shows every combination that passes the chosen rule, sorted from the strongest. The export tab produces a Markdown table for your design-system site, a CSV with both scores for every pair, JSON for tooling, and CSS that defines the palette as custom properties plus a helper class for each passing pair. Designers and developers can then pick from approved combinations instead of testing again.
What contrast numbers do not cover
All scores assume flat, opaque colours. Text over images or gradients, semi-transparent overlays, very thin fonts and anti-aliasing can make a passing pair hard to read, so check those cases visually. And remember that contrast is only one part of accessible colour: never use colour alone to carry meaning, such as red for errors without an icon or text.



