Skip to main content

Axe Core Guide

Axe Core 4.9

Elements must have sufficient color contrast (enhanced rule)

According to WCAG 2 AAA contrast ratio thresholds, all text elements must have sufficient contrast between foreground text and background colors.

Some people with impaired eyesight have little contrast, meaning there are few bright or dark areas. Everything seems approximately the same brightness, making it difficult to detect outlines, borders, edges, and particulars. Text whose luminance (brightness) is too similar to the background can be difficult to read.

Nearly three times as many individuals suffer from low vision than total blindness. About 8% of males and 0.4% of women in the United States cannot see the typical complete spectrum of colors. A person with impaired vision or color blindness cannot distinguish text against an insufficiently contrasted background.

In the background, both color transparency and opacity are taken into account.

Transparency and opacity of colors in the foreground are more challenging to detect and account for due to:

  • Background and foreground colors are same.
  • Gradient backgrounds in CSS
  • Background colors for pseudo-elements in CSS.
  • Background colors generated using CSS borders.
  • Overlap by another piece in the foreground - this can present positioning challenges.
  • Elements shifted out of the viewport using CSS.

What this Accessibility Rule Checks

Examines each text element to check that the contrast between the foreground text and background colors meets the WCAG 2 AAA contrast ratio requirements.

This rule does not report text elements that have a background-image, are concealed by other components, or are text images.

This check additionally looks for child elements of disabled buttons so that they can be ignored to prevent a false value.

Learn more:

Related Accessibility Rules