Contrast is one of the most common accessibility failures in production UIs because visual polish choices can accidentally reduce readability.
Why color contrast matters
People with low vision, color-vision deficiencies, or temporary visual constraints depend on strong contrast to read text and identify controls.
How color contrast works
WCAG uses contrast ratios:
- 4.5:1 for normal text at AA
- 3:1 for large text at AA
- 7:1 for normal text at AAA
Non-text elements such as focus indicators and icon buttons also require sufficient contrast.
Code examples
<!-- Low contrast text -->
<p style="color:#9ca3af;background:#ffffff">Your settings were saved.</p>
<!-- Improved contrast -->
<p style="color:#374151;background:#ffffff">Your settings were saved.</p>
button:focus-visible {
outline: 3px solid #1d4ed8;
outline-offset: 2px;
}
Related terms
Help us improve this glossary term
Was this guide helpful?
Scan your site
Rocket Validator scans thousands of pages in seconds, detecting accessibility and HTML issues across your entire site.
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries