Skip to main content
Fix Color Contrast Errors
Updated over a week ago

Fixing Color Contrast Issues

To achieve the minimum required contrast specified by WCAG, the text or background color must be adjusted, typically found in your style sheets. DubBot provides information on the currently calculated contrast, with interactive sliders when possible, to help you envision how much the colors need to adjust to comply with the requirements.

Failure Summary shown when text doesn't meet contrast requirements.

For AA compliance for unlinked text, WCAG requires at least a 4.5:1 color contrast ratio for normal-sized text and a 3:1 color contrast ratio for larger text.

For AAA compliance for unlinked text, WCAG requires at least a 75:1 color contrast ratio for normal-sized text or a 4.5:1 color contrast ratio for larger text.


Items that Need Manual Checking

Some color contrast situations require a more manual evaluation to ensure proper contrast is met:

  • Text over images, overlapping content in general, including CSS gradients.

  • Background colors set through CSS pseudo-elements or borders.

One such tool you can use for manual contrast testing is ColorZilla. You can select the colors for the foreground and background in question and paste the hexadecimal code for those colors into a color contrast checker such as the WebAIM Contrast Checker.


Opacity and Other Special Cases

DubBot does factor the opacity applied to color contrast checking.

Some effects, like lazy loading and pseudo-classes with changing gradients over an area, can result in automated testing issues. For some of these, we can modify the applied CSS to represent the fully loaded content or the most extreme color in the gradient. For this, users can contact us via the in-app chat or help@dubbot.com for assistance.

Link Text Contrast

Links that occur in blocks of text must have a color contrast of at least 3:1 with the surrounding text to ensure users with issues discerning different colors can still find a link on the page. If the link has a styling difference (like an underline) that does not rely on color, the contrast of 3:1 is not required.

Fix this flag:

  • Increase the contrast to 3:1 between the link text and the surrounding text OR

  • Add a style, such as an underline or bold, to the link text

Nice to have:

  • Manually check that when you hover over a link, there is a visual enhancement of the link (bolded, font change, etc.)



Dealing with Brand Colors?

A common issue is that the client's 'official' colors don't meet these contrast requirements. Luckily, often only minor adjustments are needed to reach the required contrast levels.

It is helpful to remind those decision-makers that there is a wide range of colors presented to users, when only one color is specified on the page. The color actually seen depends upon the device being used, personal screen or browser settings, and any minor changes a person may have applied.

Color specification on the web is not as concrete as in print; there is no guarantee that the color specified is what someone sees.

Often, companies add a web-only color palette that meets their chosen WCAG compliance level. This gives web authors an approved set of colors to use on web pages that pass contrast requirements and removes a layer of possible color adaptations needed that would almost certainly not be consistent across their sites.

Looking for color contrast basics? Refer to our Ensure Proper Color Contrast article.

Resources

Learn More with WCAG

DubBot Flags:

  • Elements must meet minimum color contrast ratio thresholds

  • Links must be distinguishable without relying on color

If you have questions, please contact our DubBot Support team via email at help@dubbot.com or via the blue chat bubble in the lower right corner of your screen. We are here to help!

Did this answer your question?