Code Fix Guide

How to Fix Low Color Contrast in CSS

Low color contrast is the most widespread accessibility violation, found on over 80% of all websites. Light gray text on white backgrounds, thin fonts, and poor color choices make content unreadable for millions of users with low vision.

Common Errors and How to Fix Them

Gray text on white — only 2.85:1 ratio (needs 4.5:1)
Problem
color: #999999;
background-color: #ffffff;
Fix
color: #595959;
background-color: #ffffff;
/* Ratio: 7.0:1 — passes AA and AAA */
White text on green button — only 2.3:1 ratio
Problem
color: #ffffff;
background-color: #5cb85c;
Fix
color: #ffffff;
background-color: #2d6b2d;
/* Ratio: 7.1:1 — passes AA */
Light gray on light gray — only 1.6:1 ratio
Problem
color: #b0b0b0;
background-color: #f5f5f5;
Fix
color: #555555;
background-color: #f5f5f5;
/* Ratio: 5.9:1 — passes AA */

Why This Matters

Low contrast violates WCAG 1.4.3 (Contrast Minimum). Normal text needs at least 4.5:1 contrast ratio, and large text (18pt+ or 14pt bold+) needs 3:1. This affects approximately 300 million people with color vision deficiencies and billions more with situational impairments (bright sunlight, old monitors).

Find All Your Accessibility Issues Automatically

ADA CodeFix scans your website for WCAG 2.1 AA violations and generates AI-powered code fixes — not vague descriptions, actual code you can copy-paste.

Scan Your Site Free
No credit card required AI-generated code fixes