Accessibility April 2026 · 9 min read

WCAG Color Contrast Guide for Web Designers

Poor color contrast makes your site inaccessible to millions of users with visual impairments — and it's one of the most common and easiest-to-fix accessibility issues.

What Is Color Contrast and Why Does It Matter?

Color contrast ratio measures the luminance difference between a text color and its background. A ratio of 1:1 means no contrast (same color); 21:1 is maximum contrast (black on white).

The Web Content Accessibility Guidelines (WCAG) define minimum contrast ratios to ensure readable text for users with low vision, color blindness, or who are using their device in bright sunlight.

Beyond ethics, poor contrast has legal implications — websites failing WCAG standards have faced lawsuits under the ADA in the US and equivalent laws in the EU and UK.

WCAG 2.1 Contrast Requirements

Level AA (Minimum — What You Must Hit)

Level AAA (Enhanced — Optional but Recommended)

⚠️ Gray text on white — 4.54:1 (barely AA for normal text)
✅ Darker gray on white — 7.0:1 (AAA for normal text)
✅ White on blue — 8.59:1 (AAA)
❌ White on yellow — 1.96:1 (fails AA)
✅ Dark text on yellow — 8.32:1 (AAA)

Common Color Contrast Mistakes

Light gray text on white backgrounds

Designers often use #999 or #aaa for secondary text on white backgrounds because it looks elegant. These typically fail WCAG AA. The minimum gray that passes AA on white is approximately #767676.

White text on pastel backgrounds

Light blue, mint green, lavender — these backgrounds look good but make white text nearly invisible. Always test before using.

Colored text on colored backgrounds

Red text on orange, or blue on purple — these can feel like contrasting colors to sighted users but have poor luminance ratios. Color blindness also affects the perceived difference. Always measure luminance contrast, not just hue distance.

Placeholder text

Input placeholder text is frequently styled with very low contrast. It should still meet 4.5:1 — users need to read what to type.

How to Measure Contrast

Use StudioLimb's WCAG Contrast Checker to measure any color pair instantly. Enter your text color and background color to see:

Fixing Failing Contrast

Strategy 1: Darken the text color

The most straightforward fix. If your secondary text uses #9ca3af on white, try #6b7280 or #4b5563 to reach AA compliance while maintaining the muted aesthetic.

Strategy 2: Darken the background slightly

If you're set on a specific text color, adding a subtle tint to the background can push the ratio over the threshold without disrupting the design.

Strategy 3: Increase font size or weight

Large or bold text has a lower contrast requirement (3:1 vs 4.5:1). If a decorative heading fails at 18px/regular, it may pass at 24px/regular or 18px/bold. Use this for headlines — never for body copy.

Contrast for Brand Colors

Many brand palettes include bright colors that fail on white backgrounds. A pragmatic approach: use the brand color as an accent (borders, icons, highlights) but pair text with a darkened variant or against a colored background where the ratio passes.

Don't Rely on Color Alone

WCAG also requires that information is never conveyed by color alone. Form error states must include an icon or text label, not just a red border. Chart legends must use patterns or labels, not just different colors.

Dark Mode Contrast Challenges

Dark mode introduces a specific set of contrast problems that light mode designs often don't face:

Pure white on dark backgrounds is too harsh

While #ffffff on #121212 has a contrast ratio of 18.1:1 (well above AAA), it creates eye strain in dark environments. Most design systems use #e2e8f0 or similar off-white that still passes AA (15:1+) while being much easier on the eyes.

Saturated colors need different treatment

A bright blue link (#2563eb) that passes AA on white (5.7:1) may fail on dark backgrounds. On dark navy (#0f172a), the same blue is only 3.2:1 — failing AA for normal text. Always re-check your color palette in both modes.

Dark mode testing workflow

/* Test your text colors in both modes */
@media (prefers-color-scheme: light) {
  --text-primary: #1e293b;    /* Must pass on your light bg */
  --text-secondary: #64748b;  /* Must pass on your light bg */
  --link-color: #2563eb;
}

@media (prefers-color-scheme: dark) {
  --text-primary: #e2e8f0;    /* Must pass on your dark bg */
  --text-secondary: #94a3b8;  /* Must pass on your dark bg */
  --link-color: #60a5fa;      /* Lighter blue for dark mode */
}

Use StudioLimb's Contrast Checker to verify each color pair in both modes before shipping.

Focus Indicator Contrast

WCAG 2.2 (released 2023) introduced stricter requirements for focus indicators — the outlines shown when users navigate with a keyboard. Focus indicators must now meet a 3:1 contrast ratio against both the adjacent colors and the focused element's background.

The most common failure: browsers' default blue focus ring (outline: 2px solid -webkit-focus-ring-color) fails on dark or blue backgrounds. Always define custom focus styles:

/* Custom focus styles that meet WCAG 2.2 */
:focus-visible {
  outline: 2px solid #7c5cfc;     /* your brand color */
  outline-offset: 3px;            /* gap between element and ring */
  border-radius: 4px;
}

/* On dark backgrounds, use a contrasting color */
.dark-surface :focus-visible {
  outline-color: #a78bfa;
}

The key rule: your focus ring color must have 3:1 contrast against the background it sits on, and 3:1 contrast against the element it wraps.

Automated Accessibility Testing

Manual color checking covers individual components, but automated tools find issues across the whole page simultaneously:

Lighthouse (built into Chrome DevTools)

Open DevTools → Lighthouse → check "Accessibility" → run audit. Lighthouse flags contrast failures across all visible text on the page and assigns an accessibility score. It's the fastest way to catch obvious issues.

axe DevTools (browser extension)

More thorough than Lighthouse for accessibility specifically. The free version finds the most critical issues; the paid version can test interactive states (hover, focus) that Lighthouse misses.

What automated tools miss

Automated tools cannot test: text over images or gradients (the contrast depends on which pixel of the background is behind which pixel of text), dynamic content, or elements that are visually hidden but accessible to screen readers. Manual review remains essential for complex UIs.

Brand Color Compliance: Practical Strategies

Most brand color palettes include at least one color that fails WCAG AA as a text color on white. Here's how to handle this without abandoning your brand identity:

Strategy: Use brand color as background, not text

If your brand blue (#1d4ed8) fails as body text on white, flip it — use it as a background and put white text on it. White on #1d4ed8 is 7.2:1 (AAA). Your brand color appears prominently without the contrast violation.

Strategy: Create a dark and light variant

For each brand color, define a darkened variant for text on light backgrounds and a lightened variant for text on dark backgrounds:

:root {
  --brand-primary: #7c5cfc;        /* Base — use as background only */
  --brand-on-light: #5b3fcc;       /* Darkened — text on white bg, passes AA */
  --brand-on-dark:  #a78bfa;       /* Lightened — text on dark bg, passes AA */
}

/* Usage */
.tag        { background: var(--brand-primary); color: white; }
.link       { color: var(--brand-on-light); }
.dark .link { color: var(--brand-on-dark); }

Strategy: Use brand colors for large text and decorative elements only

Large text (18pt+ / 14pt+ bold) has a lower requirement of 3:1 instead of 4.5:1. If your brand color fails for body text, it may pass for headings. Use it where the threshold is lower — never as small body text on white.

Frequently Asked Questions

What contrast ratio do I actually need to meet?

For most commercial websites, Level AA is the target — 4.5:1 for normal text, 3:1 for large text and UI components. Level AAA (7:1 for normal text) is a stretch goal and isn't required by most legal standards. Focus on AA compliance first; AAA is an enhancement, not a baseline.

Does contrast matter for decorative images?

No. WCAG contrast requirements apply to text and informational UI components (buttons, form controls, icons that convey meaning). Purely decorative images — backgrounds, illustrations that don't carry information — are exempt.

What about color contrast on gradients?

Text over a gradient is tricky because the contrast changes across the gradient. The safest approach: measure contrast against the lightest color in the gradient range. If the text passes against the lightest background it will encounter, it's safe everywhere. Alternatively, add a subtle text-shadow or scrim to lock the effective background color.

Is there a legal requirement to meet WCAG?

In many jurisdictions, yes — particularly for public sector organizations, businesses in the EU under the European Accessibility Act (EAA, effective 2025), and any US business serving the public under the ADA. Courts have increasingly ruled that WCAG AA is the implicit accessibility standard for websites. Beyond legal compliance, accessible contrast simply makes your product usable by more people.

Related Guides

contrast

Contrast Checker

Check WCAG AA & AAA instantly

color_lens

Color Palette Generator

Generate accessible color schemes