NEARFIELD·TOOLS

Color palette contrast checker

Paste a palette or a block of CSS colour tokens and see the contrast of every pair at once, judged against WCAG 2.2 and its EN 301 549 clause, with the whole palette laid out on one lightness ruler.

Up to 16 colours as #rgb, #rrggbb, #rrggbbaa or rgb(). A name on the same line is kept, so CSS custom properties, Sass variables and JSON tokens paste as they are. Lines without a colour, like :root {, are skipped.

Download CSV
—
pairs for body text (4.5:1)
—
pairs for large text and UI (3:1)
—
pairs at AAA (7:1)

Each dot sits at its colour's contrast against black. The gap between any two dots is their contrast ratio, whatever their hue.

Checking the colours as they are actually used in a design? Nearfield Accessibility, our free Figma plugin, measures every text layer and component against the colour painted behind it and maps each finding to its EN 301 549 clause.

Every pair

Rows are the text or icon colour, columns the background. AAA 7:1 or more; AA 4.5:1, body text; AA large 3:1, large text and the parts of a control or graphic covered by 1.4.11. Ratios are cut to two decimals, never rounded up.

How to read the grid

Each cell shows the row's colour as text on the column's colour, the contrast ratio, and the highest level it reaches. The thresholds come from three criteria. 1.4.3 Contrast (Minimum), level AA, asks for 4.5:1 for body text and 3:1 for large text, which is 24 px, or 18.67 px bold. 1.4.11 Non-text Contrast, also AA, asks for 3:1 for the parts of a control you need to see it, such as a field border or a focus ring, and for the parts of a chart or icon you need to understand it. 1.4.6 Contrast (Enhanced), level AAA, raises text to 7:1 and 4.5:1. EN 301 549, the standard the European Accessibility Act points to, adopts the A and AA criteria as clauses 9.1.4.3 and 9.1.4.11; it does not adopt AAA. The CSV has one row per ordered pair with all five verdicts, for an audit file or a design-system page.

The ratio is symmetric: white on teal and teal on white are the same number. Both orders are shown anyway, because a palette is read by role, and it is easier to scan a row for "which backgrounds can this text colour sit on" than to look up half the answer in a column.

Contrast depends on lightness only

WCAG's ratio is (L1 + 0.05) / (L2 + 0.05), where L is relative luminance. Hue does not enter it except through luminance, so every colour can be placed on one line, at log(L + 0.05), and the contrast between any two colours is the distance between them on that line. That is what the ruler above draws. Two colours pass 4.5:1 exactly when their dots are at least the 1-to-4.5 tick distance apart, whether they are two greys, a teal and a violet, or a red and a green.

The ruler also explains two facts that otherwise look like coincidences. Black and white are 21:1 apart, and the square root of 21 is 4.58, so every colour reaches at least 4.58:1 against black or against white: there is always a text colour that passes AA, which is why the color contrast checker can always suggest one when the background is the thing you are keeping. The reverse holds for AAA: 21 is less than 7 squared, so a band of mid-tones, with luminance between 0.10 and 0.30, reaches 7:1 against neither black nor white. A brand colour in that band can never carry AAA text, on any background.

Building a ramp that passes by construction

Because contrast is a distance on this line, a colour ramp whose steps are spaced evenly in log(L + 0.05) passes by arithmetic: any two shades a fixed number of steps apart have the same ratio, whatever the hue. The US Web Design System applies the same idea: it grades every colour by luminance, so that a grade difference of 50 or more guarantees 4.5:1. The accessible color palette generator builds such a ramp from any brand colour, with the steps numbered so that 500 apart means 4.5:1. Paste a ramp into the grid and the ruler shows at once whether its steps are even or bunched at one end, which is the usual reason a 500 passes on white and a 600 of another hue does not.

Translucent tokens

A colour with an alpha below 1 has no contrast of its own; it depends on what is behind it. The grid lays each translucent colour over white and measures the result, and says so. For text at a given opacity over a known background, use the single-pair checker, which composites the text over the real background the way a browser does.

FAQ

Does a palette that passes here pass for colour-blind users?

For contrast, nearly: colour blindness changes hue far more than lightness, and contrast is lightness. The exception is protan vision, in which reds look darker, so red text that only just passes reads weaker. Telling the colours apart is a different question, covered by 1.4.1 Use of Color. The color blindness simulator shows which palette colours run together for protan, deutan and tritan viewers.

Why does a pair the browser's DevTools passes fail here?

Usually rounding. A ratio of 4.499:1 fails 1.4.3, but rounded to one decimal it reads 4.5. This grid cuts ratios to two decimals and compares the unrounded value with the threshold, so #777777 on white shows 4.47 and AA large, not AA.

Is the grid enough for an audit?

It shows which pairs a design system allows. An audit checks the pairs a design actually uses, including text over images and gradients, which a palette cannot know about. The grid is the first step: it tells a team which combinations to forbid before anyone builds a screen. Contrast is two criteria out of 55; the WCAG 2.2 checklist lists the rest with their EN 301 549 clauses.