Color contrast

Also called contrast ratio, WCAG contrast, or text contrast

How much text stands out from its background, measured as a ratio from 1:1 to 21:1 and checked against the WCAG levels AA and AAA.

What is Color contrast?

A contrast ratio compares the relative luminance, or perceived brightness, of two colors. Black on white is 21:1, the maximum, and any color on itself is 1:1. The Web Content Accessibility Guidelines (WCAG) turn that number into pass and fail levels.

Level AA, the usual target, asks for at least 4.5:1 for normal text, and 3:1 for large text (24px, or about 19px bold), icons, and the outlines of controls. Level AAA asks for 7:1 for normal text and 4.5:1 for large text. Light gray placeholder text, white text on bright buttons, and text over photos are the most common failures.

Check contrast while you choose colors: browser dev tools show the ratio in their color pickers, and design tokens can pair each text color with the backgrounds it passes on. Never round up, because 4.48:1 still fails AA.

All terms

Typographic hierarchy

Using differences in text size, weight, and color so people can tell at a glance what to read first, second, and last.

Accent color

The one highlight color an interface uses for actions and selected states, and the CSS property that tints native form controls.

Dark mode

An alternate color theme with light text on dark backgrounds, chosen in settings or matched to the device’s system setting.

Focus ring

An outline that marks which element has keyboard focus, so people moving through a page with the Tab key can see where they are.