Accessibility

How to Fix Color Contrast Issues

Lighthouse flags text whose foreground and background colors do not have enough contrast for readability. Learn how to meet WCAG contrast requirements.

What Lighthouse Is Telling You

When Lighthouse flags “Background and foreground colors do not have a sufficient contrast ratio,” it means text on the page is hard to read because the color difference between the text and its background is too low. This is a weight-7 accessibility audit that directly affects readability for everyone — not just users with vision impairments.

Lighthouse tests every text element on the page and reports those that fail the WCAG 2.1 Level AA contrast ratio thresholds.

Why Contrast Matters

The Old Way to Fix It

  1. Run Lighthouse or an accessibility scanner
  2. For each flagged element, note the current foreground and background colors
  3. Use a contrast checker (WebAIM, Chrome DevTools color picker) to find the current ratio
  4. Adjust either the foreground or background color until the ratio reaches 4.5:1
  5. Check that the adjusted color still fits the design system
  6. Update the color in CSS or the design token
  7. Re-run Lighthouse for each page where the color appears
  8. Repeat for every flagged element

The challenge is balancing accessibility requirements with design aesthetics. Designers often resist darkening light grays or lightening dark backgrounds because it changes the visual feel.

The Frontman Way

Tell Frontman to fix your Lighthouse issues. That is the entire workflow.

Frontman has a built-in Lighthouse tool. It runs the audit, reads the failing scores, fixes the underlying code, and re-runs the audit to verify the score went up. If issues remain, it keeps going — iterating through fixes and re-checks until the metrics pass. Because Frontman sees the rendered page, it knows the actual computed colors — not just what is in the stylesheet. You say “fix the Lighthouse issues on this page” and Frontman handles the rest.

Key Fixes

People Also Ask

What is a contrast ratio?

The contrast ratio is the difference in luminance between two colors, expressed as a ratio from 1:1 (identical colors) to 21:1 (black on white). It is calculated using the relative luminance formula from WCAG 2.1.

Does color contrast apply to images of text?

Yes. WCAG 1.4.3 applies to images that contain text (like banners or infographics with embedded text). The same 4.5:1 ratio applies. The fix is either adjusting the image or replacing the image text with real HTML text.

How do I handle contrast with semi-transparent backgrounds?

Calculate the effective background color by compositing the semi-transparent color against the underlying background. If the underlying background varies (like an image), test against the lightest and darkest areas. Tools like the Chrome DevTools color picker handle alpha compositing automatically.

Do icons need to meet contrast requirements?

Icons that convey meaning (like a warning icon or a navigation icon without text) need to meet the 3:1 non-text contrast ratio from WCAG 2.1 Level AA (guideline 1.4.11). Decorative icons that accompany text do not need to meet contrast requirements independently.


You can use Frontman to automatically fix this and any other Lighthouse issue. Frontman runs the audit, reads the results, applies the fixes, and verifies the improvement — all inside the browser you are already working in. Get started with one install command.