metricExperience & interface

Color Contrast

Color contrast is the luminance difference that helps text, icons, controls, states, and focus indicators remain distinguishable from adjacent colors.

Download Markdown (.md)

01What it means

WCAG defines contrast-ratio requirements for text and separate requirements for meaningful non-text graphics and user-interface component boundaries or states. Contrast is calculated from relative luminance, not guessed from hex distance or subjective brightness.[1][2][3]

Relative luminance, not subjective brightness Measure the rendered foreground against its adjacent background
Contrast ratio = (Llighter + 0.05) ÷ (Ldarker + 0.05)
Foreground
Rendered text, graphic, boundary, or state
Background
Immediately adjacent rendered color
Criterion
Text size and weight or non-text requirement
Redundancy
Add text, shape, position, or icon—not color alone

Required ratios depend on whether the element is text, large text, meaningful graphics, or a component boundary/state. Color must not be the only signal.

02Why it matters

Low contrast can make content and controls difficult or impossible to perceive for people with low vision, color-vision differences, aging eyes, or challenging displays and lighting. Systematic contrast decisions also reduce fragile one-off fixes across themes and states.

03When to use it

Check contrast while selecting tokens, designing components, creating data visualizations, adding imagery, and implementing interaction states. Recheck every theme and state, including hover, focus, selected, disabled, error, and text over images.

04How it works

  1. Identify the foreground and immediately adjacent background for each meaningful element.
  2. Calculate contrast using the WCAG method and the criterion relevant to text or non-text content.
  3. Test normal, large, bold, interactive, and stateful variations independently.
  4. Avoid using color as the only signal; add text, shape, position, or iconography.
  5. Encode approved semantic pairs in tokens and automated tests where practical.
  6. Review rendered results under zoom, high contrast settings, themes, and real devices.

05A practical example

Example

A design system pairs text tokens with approved surface tokens instead of publishing an unrestricted palette. Its error field uses a clear message and icon as well as color, and the field boundary, message, and focus indicator are each checked against their adjacent backgrounds.

06Where it breaks

A passing ratio does not guarantee readability: type weight, size, glare, gradients, transparency, and visual clutter still matter. WCAG exceptions and thresholds must be applied to the right element, and disabled controls still need enough clarity for users to understand the interface.

Common mistakes

  • Checking palette swatches but not actual foreground-background pairs.
  • Testing only default states and forgetting focus or selected states.
  • Using a brand color unchanged across light and dark themes.
  • Communicating status by red and green alone.
  • Assuming automated contrast results prove overall visual accessibility.

07Sources

  1. Understanding Success Criterion 1.4.3: Contrast (Minimum)W3C Web Accessibility Initiative · Standards guidanceUnderstanding Success Criterion 1.4.3: Contrast (Minimum)
  2. Understanding Success Criterion 1.4.11: Non-text ContrastW3C Web Accessibility Initiative · Standards guidanceUnderstanding Success Criterion 1.4.11: Non-text Contrast
  3. Web Content Accessibility Guidelines (WCAG) 2.2World Wide Web Consortium · StandardWeb Content Accessibility Guidelines (WCAG) 2.2
View saved topics

Start typing to search titles, definitions, categories, and frameworks.