GuidesAccessible design

A practical guide to checking interface contrast

A repeatable workflow for checking text contrast in real components, themes, states, and layered backgrounds, with clear limits on what a ratio can prove.

accessibilitycontrastcolordesign systemstesting

Begin with meaning, not the palette

A contrast review is easier to use when it starts with the words on a page instead of a spreadsheet of brand colors. Find the text that explains an action, identifies a field, reports an error, or tells someone what happened. Small labels and quiet captions can carry important meaning, so include them even when a design system calls them secondary.

The WCAG 2.x contrast criterion compares text with its immediate background. For AA, normal-sized text uses a 4.5:1 minimum and qualifying large text uses 3:1. The AAA text levels are higher: 7:1 for normal text and 4.5:1 for large text. First establish which level and scope you are evaluating; do not quietly substitute a house preference for the criterion itself.

Make an inventory of what is visible in a real task. Include field labels, instructions, validation messages, navigation, status badges, captions, and text inside controls. If a word is needed to understand a choice or result, it belongs in the review even when it appears only after an interaction.

Understand what a ratio can and cannot say

The ratio is calculated from relative luminance, a measure of the light reflected or emitted by a color in the sRGB model. It ranges from 1:1 for equal luminance to 21:1 for black against white. Hue names alone are not enough: two colors can feel different while carrying nearly the same luminance, or appear similar while producing a useful separation.

A calculation is only as good as the colors supplied to it. Opaque hex values are straightforward; a translucent foreground or background must first be composited in the order the browser displays it. A card on a tinted panel over an image can involve several layers. A gradient also contains a range of possible backgrounds, so inspect the least favorable point that can appear under the text.

The ratio does not measure font shape, weight, antialiasing, visual crowding, or the comfort of every reader. It does not tell you whether text is meaningful, whether an icon is recognizable, or whether an action can be completed with a keyboard. Keep the numeric result in its lane and write down the other questions that need a separate check.

Use a checker for the pair you actually see

A small calculator is a good first pass for a pair of opaque colors. Choose the foreground and the background directly behind the glyphs, not a nearby token that looks related. Compare the full result with the applicable threshold, then retain the exact pair and interface state in your notes so another person can reproduce the check.

When a color token is used over several surfaces, check each combination or deliberately constrain the component to one verified surface. If a brand token appears in both light and dark themes, treat those as separate cases. A pair that passes on a cream card may fail when the card becomes transparent or the text changes to a muted role.

If a calculator says the ratio passes but the words still seem difficult to find, do not stop at the number. Check whether the text is too small, thin, crowded, hidden by nearby decoration, or dependent on color alone. A successful contrast result answers one measurable question, not every question about perception.

Walk through states and layouts

Review a component through the states people encounter: default, hover, focus, pressed, selected, disabled, loading, and error. Some states replace the background without changing the text color; others put the same text on a different layer. The keyboard focus outline needs its own consideration because a text ratio does not measure the outline against adjacent surfaces.

Repeat the review at the widths where the layout changes. Text can wrap onto a banner, a caption can move below a tinted image, or an inline control can become a full-width button. Seasonal themes and user-selected display preferences can also alter color tokens. Capture the rendered view when a static token list cannot show which layers meet on screen.

Prioritize the combinations that communicate action or state. A decorative illustration may have different requirements from a label that tells someone which choice is selected. Record why a text element is in scope rather than assuming that every pale pixel must be treated identically.

Run a reproducible review

A written method makes a small design review easier to repeat after a component or theme changes. Scope the route, state, viewport, and display mode before calculating anything. Save the names of the roles and surfaces, not just raw color values, so the result remains useful when tokens are reorganized.

  1. List the pages, themes, viewport widths, and interaction states that the review covers.
  2. Identify meaningful text and the exact rendered surface immediately behind each line.
  3. Resolve transparency and layered backgrounds before entering an opaque pair into the calculator.
  4. Compare the unrounded ratio with the applicable text threshold and record the result with its context.
  5. Retest after changing a shared token, then inspect focus, reflow, and color-independent cues separately.

Fix recurring causes instead of isolated symptoms

A repeated failure across many pages often points to a semantic token rather than a single screen. If secondary text is consistently too faint, update the role that names that text instead of adding slightly darker one-off values everywhere. A component-specific exception can still be right when it has a truly different background or meaning; document the reason so later edits do not undo it.

A local fix should also preserve the rest of the interface. Darkening one label may create a new mismatch with its icon, hover state, or disabled treatment. Re-run the route and state matrix after changing a token because shared values can affect more pages than the one where the first issue appeared.

Automated checks help prevent known color pairs from regressing, while manual review covers gradients, artwork, motion, and unusual compositing. Keep both: a screenshot can reveal an unexpected background, and a repeatable numeric check can confirm that a deliberate correction continues to meet its target.

Report the result without overstating it

Describe what was measured, where it appeared, and which threshold applied. “The body-text token on the default panel measured 5.2:1 at the desktop state” is more useful than “the page is accessible.” The first statement can be checked and reproduced; the second implies a much broader review that one color pair cannot establish.

If a pair falls short, record the problem and the next action in plain language. It may require a darker text token, a more solid surface, a different placement, or a non-color label. If a pair passes, keep the scope attached to the result and continue with keyboard operation, focus visibility, reflow, and other relevant checks.