Web design, CMS and development, since 2014VR Games
Web design

Colour Contrast: The One Accessibility Rule Worth Learning Properly

Do you know the colour contrast ratio web design must follow to pass accessibility checks? The Web Content Accessibility Guidelines (WCAG) 2.1 require that visual text have a minimum contrast ratio of 4.5:1, except for large-scale text which must have a contrast ratio of 3:1. However, all too often, designers fail to meet this requirement, putting the fundamental accessibility of their work at risk. But it doesn't have to be that way. By understanding the basics of contrast and using the right tools, designers can create beautiful palettes that pass accessibility muster.

The One Number That Keeps Text Legible

At the heart of accessible colour contrast is a simple metric: the contrast ratio between text and its background. WCAG 2.1 defines this threshold with two key ratios: a minimum of 4.5:1 for normal text and 3:1 for large text (18pt or 14pt bold, or larger). For graphical elements and UI components, the guideline specifies a 3:1 ratio.

But what exactly is this ratio? It's a mathematical expression of the relative luminance of the two colors, from 1 (no contrast) to 21 (maximum contrast). The formula, as specified by WCAG, is (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter color and L2 is the darker.

Here's where the rubber meets the road for designers. To satisfy Level AA compliance, text smaller than 18pt must have a contrast ratio of at least 4.5:1. Only text 18pt (24px) and larger, or 14pt (19px) and larger if bold, is eligible for the reduced 3:1 ratio.

An often-cited example: grey #767676 on white #FFFFFF yields a contrast ratio of about 4.54:1, just passing the threshold. But the more common #999999 falls short at 2.85:1. It's a distinction every working designer must know.

Where Designers Keep Failing Contrast

The path from the WCAG 2.1 guidelines to an accessible interface is pitted with perils. Every designer has likely made these missteps:

  • Light grey (e.g. #999999) used as body text on white or other very light backgrounds
  • Pastel or soft buttons that fade into light backgrounds, leading colorblind and low-vision users to miss key interactive elements
  • Color-on-color text (e.g. blue text on a blue background) that relies on slight hue differences to convey meaning
  • Text placed over busy images or background gradients, with insufficient contrast from the foreground or local background
  • Ultra-thin or ultra-light fonts, which reduce the effective contrast of the text color, even if it meets the minimum luminance ratio

But perhaps the most widespread failure is treating 4.5:1 as an afterthought, or assuming a pale grey will safely pass, without testing. Without the right tools, the result is an interface that's much prettier than accessible.

How Contrast Is Really Measured (Not Just Eyeballed)

"What's the contrast?" - it's the key question for accessible design, and one that's more easily answered by tools than by the naked eye or even the most color-adept designer. That's because the contrast root is in luminance, a measure of perceived brightness, not color itself.

The calculation, while complex, boils down to a concept every designer can grasp. WCAG defines "contrast ratio" as the ratio of the relative luminance of the lighter color to the darker. That ratio is expressed as L1:L2, where L1 is the relative luminance of the lighter color and L2 is that of the darker.

It's a formula every designer can master, and one that's already built into the accessibility tools that check it.

Checking a Real Page, Not Just a Swatch

The real test of accessibility is not just the raw color swatches, but how those colors behave on a live, accessible web page. That's why the most powerful tools check contrast on real pages, not just abstract color pairs.

Using Lighthouse, simply open Chrome's DevTools and run an audit, selecting the Accessibility category. A list of failing elements flags items like low-contrast text and interactive elements. Beneath, Lighthouse explains the precise WCAG criteria that failed.

WAVE takes it further, highlighting low-contrast text directly on the page and providing a graphical contrast checker for any element. And like Lighthouse, WAVE can be integrated directly into your site design and testing workflow.

Finally, axe DevTools, opts for a detailed line-by-line breakdown where each problem maps to a specific WCAG Success Criterion, even detailing the 18pt or 14pt-size text thresholds for large vs. small text ratios.

Designing Palettes That Pass Without Going Dull

The good news: WCAG-compliant palettes needn't be grey, dull, or even low-saturation. The requirement is for sufficient luminance difference, not greyscale contrast. That means deep colors and pale hues can team up, while still passing ratio requirements.

If you're constructing a palette, try treating the 4.5:1 contrast threshold as a boundary condition. Explore color combinations, and test them. If your key text colors don't meet the required ratio, adjust, rather than abandoning the colors.

Of course, actual readability depends on more than just luminance. Pair your contrast decisions with the scale, weight, and spacing of your fonts, and avoid placing hard-to-read text over busy backgrounds.

As you lay out an accessible interface, consider incorporating contrast-checking tools into your color and typography workflow. For example, try integrating a contrast checker like WebAIM's free tool directly into your site, to catch ratio failures as you go.

Contrast as Craft, Not Compliance

When it comes to color on screen, contrast is a craft skill, and not just a "check the box" compliance task. These WCAG ratios - 4.5:1 for text and 3:1 for UI and graphics - are design constraints, like spacial grids, type scales, and column counts. They are thresholds to which every designer must pay mind.

That means knowing your ratios. It means testing actual pages, not just swatches. It means avoiding the common pitfalls that you already know about. And it means crafting beautiful, informative, and accessible interfaces, with contrast built in, rather than bolted on.