◎Home
← All posts

How to Use a Contrast Checker (and the Pairs Most People Measure Wrong)

2026-11-23 · zhoujingkang · Founder

A contrast checker is the simplest tool in the accessibility kit — paste two colors, read a number — and it is also the one most often used wrong. When a pair 'fails', the design is frequently fine and the measurement is not: the checker was pointed at the page background instead of the card the text sits on, or at a hex that carries an alpha channel, or at a dark theme that is a lazy inversion of the light one. This guide covers the pairs that actually need checking, the four measurement mistakes that produce most false alarms, and a three-minute routine to run before you ship.

The pairs that actually need checking

WCAG 2.1 sets thresholds by text size — 4.5:1 for normal body text, 3:1 for large text — and 3:1 for meaningful non-text UI under 1.4.11. APCA adds a perceptual model with thresholds that scale by font size and weight. Both models judge a foreground/background pair, so the entire discipline is choosing the right pairs before reading any numbers:

  • Body text against the surface it sits on — the card, not the page behind the card.
  • Secondary and muted text against its surface — the quiet 3.6:1 grays that make up most real-world failures.
  • Interactive labels — button text, links, icon-only buttons' visible boundary — against their resting and hover states.
  • Status pairs — success, warning, danger text on their tinted chips — where hue families are closest together.

Mistake 1: measuring against the page background instead of the surface

The most common error is structural: the text lives on a card, but the checker gets the page background. On a white page with a #F4F4F5 card and #71717A text, text-on-page measures about 5.4:1 — a pass — while text-on-card measures about 4.4:1, a fail for normal text. Nothing about the design changed; the sampled pair did.

This is why DevTools-driven audits mislead more than they help on card-based layouts: the picker grabs what's easiest to hover, not what's composited behind the glyphs. Measure against the actual surface — and on gradient or image backgrounds, against the worst region the text crosses, not the average.

Mistake 2: trusting a hex that carries alpha

A token like rgba(23, 23, 23, 0.62) is not a color — it is a recipe for blending with whatever is underneath. Its effective contrast depends entirely on the surface behind it, and alpha-composited colors never appear in a token table. A widely shared real-world case among icon maintainers made this vivid: the same SVG on a translucent card collapsed from 4.42:1 to 1.0 with no token changing.

The practical rules: measure text over translucent surfaces against the composited result, not the source hex; keep alpha off brand-critical text; and verify overlay pairs against the real backgrounds at runtime. If your contrast checker accepts rgba, make sure it composites before it computes — otherwise it is reporting the pair your design doesn't ship.

Mistake 3: inverting a light theme and calling it dark mode

Near-black surfaces distort the WCAG ratio itself: the luminance model produces false passes and false failures exactly where dark mode lives. Teams that generate a dark theme by flipping lightness keep one set of contrast margins from the light theme and inherit a different set of verdicts on the dark surfaces — which is why measured dark themes are their own set, not an inverted copy.

On top of the model mismatch, there is a workflow one: dark themes multiply surfaces (elevated cards, tooltips, overlays), so a checker pass on the page background says nothing about the text sitting on the elevation stack. Check the dark set pair by pair, and let APCA arbitrate the near-black rows where the ratio is least trustworthy.

Mistake 4: reading only one model's verdict

WCAG and APCA answer different questions, and the pairs where they disagree are precisely the ones users complain about. A working designer put it plainly recently: "i still mix up wcag and apca numbers so having both in the same picker would save me a second." The one-second save is real, but the deeper point is that single-model checkers hide the disagreement — a pair can clear 4.5:1 and still read weak under APCA's Lc 60 line for body text.

The workable policy is boring and strict: treat a pair as done when both verdicts pass. In the rare case where a pair cannot satisfy both, the fix is the same either way — adjust the role's lightness, not the standard's threshold.

A three-minute pre-ship routine

The routine that catches most real failures is short enough to run on every PR:

  • Minutes 0–1: collect the three text styles and their real surfaces from the rendered page — not from the token file.
  • Minutes 1–2: measure each pair under WCAG and APCA together, and re-sample any pair whose background has alpha.
  • Minutes 2–3: fix failures by moving lightness within the hue, then re-measure the fixed pair — and record the numbers where the theme is defined so the next audit is an export, not a project.

Continue with a tool

References

FAQ

What does a contrast checker actually measure?

It computes a ratio (WCAG 2.1) and, in better tools, a perceptual Lc value (APCA) for one foreground/background pair. The measurement is only as good as the pair you feed it — the surface the text actually sits on, composited if that surface is translucent.

Why does my pair pass on one tool and fail on another?

Three usual reasons: the tools compute different models (WCAG ratio vs APCA Lc), one composites alpha and the other doesn't, or they were given different background pairs. Standardize on both models and composited inputs.

What contrast ratio should I aim for?

WCAG 2.1 AA: 4.5:1 for normal text, 3:1 for large text and non-text UI. Under APCA, roughly Lc 60+ reads as comfortable for body text and lower thresholds are acceptable for large display text — check both before shipping.

Do I need to re-check colors in dark mode?

Yes. Near-black surfaces distort the WCAG ratio, dark themes add elevation surfaces, and an inverted light theme inherits none of the correct margins. Measure the dark set as its own verified set.

Can a contrast checker fix a failing pair for me?

The good ones suggest the closest passing color that keeps the original hue — contrast responds to luminance, so fixes are usually small lightness moves rather than a repaint.

Try it on your own brand color

Paste one hex into the Brand Theme Engine and get a full light & dark web theme — semantic tokens, contrast-checked, export-ready.

Open the Brand Theme Engine →