SiteLint

  1. Home
  2. Docs
  3. SiteLint
  4. Accessibility Rules
  5. color-contrast-aaa

color-contrast-aaa

Print this article

Description

This rule determines if text and controls have enough color contrast.

Text and interactive elements need to have high contrast so that the content is readable to everyone. High contrast especially benefits site visitors that may have low vision, color blindness, or aging. It can also help mobile users still see content even if the screen is being affected by sun glare.

The W3C Web Content Accessibility Guidelines 2.0 define specific contrast ratios that must be met in order to comply at particular levels. In order to meet the guidelines at Level AAA, the contrast ratio must be at least 7:1 (or 4.5:1 for large text).

There are some exceptions to this rule, including:

  1. Large TextLarge-scale text and images of large-scale text have a contrast ratio of at least 4.5:1.
  2. Incidental – Text or images of text that are part of an inactive user interface component, that are pure decoration, that are not visible to anyone, or that are part of a picture that contains significant other visual content, have no contrast requirement.
  3. Logotypes – Text that is part of a logo or brand name has no contrast requirement.

Note that the rule also displays WCAG 3.0 APCA computed contrast. The Advanced Perceptual Contrast Algorithm (APCA) is a new way to compute contrast based on modern research on color perception. Compared to AA/AAA guidelines, APCA is more context-dependent. APCA is a public beta, under active development.

The contrast is calculated based on the following features:

  • Spatial properties (font weight and text size)
  • Text color (perceived lightness difference between text and background)
  • Context (ambient light, surroundings, and intended purpose of the text)

How to fix it

  • Review the background and foreground text color to ensure it meets the requirements.
  • Use the tool Color Contrast Finder to find the closest colors that pass the color contrast ratio.
  • Use the tool Contrast text on image to check the contrast for the text that overlaps the image.

Known Limitations

Determining color contrast ratio programmatically is limited due to technical limitations (browser doesn’t provide enough information) or for certain scenarios like the text on an image, or the background has a gradient, or mix-blend-mode is used. Therefore in some cases, a manual check is required to ensure the color contrast matches the requirements.

Was this article helpful to you? Yes No
SiteLint Audits: Monitoring in real-time Accessibility, Performance, Privacy, Security, SEO, Runtime Errors and Console Logs