Accessible color contrast (WCAG 2.2)
By Theo Lane (pen name; AI-assisted, hand-checked) ·
Contrast is the single most common accessibility failure on the web. Year after year, automated audits of the top million home pages find low-contrast text on the large majority of them. The good news: it is also one of the easiest problems to fix once you understand the rules.
How the contrast ratio is calculated
WCAG defines contrast using relative luminance — how much light a color emits, weighted for human sensitivity (we are far more sensitive to green than to blue). Each sRGB channel is linearized, then combined as 0.2126 R + 0.7152 G + 0.0722 B. The contrast ratio between two colors is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter. The result runs from 1:1 (no contrast) to 21:1 (black on white).
Two consequences surprise people. First, hue barely matters: a saturated red and a gray of the same luminance have the same contrast against white. Second, mid-tones are a trap. A color that is “halfway” between black and white in luminance has only about 4.6:1 against either — barely passing in one direction.
The thresholds in WCAG 2.2
- 1.4.3 Contrast (Minimum), Level AA: 4.5:1 for normal text; 3:1 for large text.
- 1.4.6 Contrast (Enhanced), Level AAA: 7:1 for normal text; 4.5:1 for large text.
- 1.4.11 Non-text Contrast, Level AA: 3:1 for visual information needed to identify UI components and states (input borders, focus indicators, toggle states, chart elements, meaningful icons) against adjacent colors.
“Large text” means at least 18 point (24 CSS px) at regular weight, or 14 point (about 18.66 px) bold. Logos and purely decorative text are exempt, as is text in inactive (disabled) components — though disabled states that are unreadable still frustrate everyone.
Ratios are not rounded. 4.48:1 fails AA. Palg’s contrast checker truncates to two decimals for that reason.
Common mistakes
- Gray placeholder text. Light gray placeholders on white often sit near 2:1. If placeholder text carries instructions, it must pass.
- Brand color buttons with white labels. Many brand oranges, yellows and light greens cannot carry white text at 4.5:1. Either darken the button, use dark text, or make the label large and bold enough to qualify as large text.
- Text over images. Contrast must hold against the busiest part of the image behind the text. Use a scrim or a solid panel.
- Focus rings. A 1px light-blue outline on white fails 1.4.11. Make focus indicators thick and high-contrast.
- Charts. Adjacent bars or pie segments need 3:1 against each other or a visible separator, plus non-color cues like labels.
- Dark mode afterthoughts. Inverting a light theme rarely produces good contrast; design dark surfaces with their own lightness steps.
Fixing a failing pair without losing the brand
When a pair fails, the instinct is to swap in black or white. Often you can keep the hue and adjust only lightness. In a perceptual space such as OKLCH, darken the foreground (or lighten the background) in small steps until the ratio passes. The color remains recognizably “your blue”, just a shade deeper. Palg’s checker does this automatically and offers the nearest passing color for AA and AAA.
A sustainable approach is to build a 50–950 scale for each brand color (see building a UI color system) and document which step pairs pass. For example: text on steps 50–200 uses 700 or darker; white text sits on 600 or darker.
Where APCA fits
The Accessible Perceptual Contrast Algorithm (APCA) is being developed as a candidate for a future WCAG 3. It models perception more closely than the 2.x ratio: it treats dark-on-light and light-on-dark differently, and it scales requirements with font size and weight. It reports a value called Lc, roughly 0 to 106 for dark text on light and to about −108 for the reverse.
APCA is not part of WCAG 2.2 and is not a legal or procurement standard today. If you must meet ADA, Section 508 or EN 301 549 requirements, WCAG 2.x ratios are what count. Palg shows APCA as a labeled, advisory second opinion; where the two disagree, it is worth a closer look — especially for light text on dark backgrounds, where the 2.x formula is known to be somewhat lenient.
Contrast is necessary, not sufficient
Passing contrast does not guarantee readability. Thin fonts, small sizes, long line lengths and busy backgrounds all degrade legibility. And contrast says nothing about color vision deficiencies: two colors can pass 4.5:1 against white yet be indistinguishable from each other for someone with deuteranopia. Pair contrast checks with the color blindness simulator and never use color as the only signal.
A checklist
- Body text and icons that carry meaning: 4.5:1 or better.
- Large headings: 3:1 minimum, 4.5:1 preferred.
- Borders, focus rings and chart elements: 3:1 against neighbors.
- Check hover, focus, error, disabled and dark-mode states, not just the default.
- Re-check after any brand refresh.