Low-contrast text affects approximately 300 million people with color vision deficiencies and countless others reading in bright sunlight or on older displays.
Lighthouse flags text where the contrast ratio between foreground and background colors doesn't meet WCAG 2 AA thresholds. Normal text requires a ratio of 4.5:1, while large text (18pt or 14pt bold) needs 3:1. This audit uses axe-core to calculate the luminance difference between your text and its background.
color and background-colorDarken light text or lighten dark text until you reach the required ratio.
/* Before: 2.5:1 ratio - fails */
.subtitle {
color: #999999;
background: #ffffff;
}
/* After: 4.6:1 ratio - passes */
.subtitle {
color: #767676;
background: #ffffff;
}
Sometimes changing the background is more practical than changing text.
/* Before: fails on white background */
.highlight {
color: #ffc107;
background: #ffffff;
}
/* After: passes with darker background */
.highlight {
color: #ffc107;
background: #1a1a1a;
}
Create accessible color scales that guarantee contrast.
:root {
--text-primary: #1f2937; /* 12.6:1 on white */
--text-secondary: #4b5563; /* 7.5:1 on white */
--text-muted: #6b7280; /* 5.0:1 on white */
}
.card {
color: var(--text-secondary);
background: #ffffff;
}
app.config.ts to define color tokens that meet WCAG standards:export default defineAppConfig({
ui: {
colors: {
primary: 'blue',
neutral: 'slate'
}
}
})
#aaa) is intentionally low contrast; don't apply it to actual contentColor contrast issues often appear alongside:
Color contrast issues often hide in footers, captions, and secondary content that gets overlooked during manual review. Unlighthouse scans every page of your site automatically, catching contrast failures across your entire domain so nothing slips through to production.