How to fix low contrast text
WCAG 1.4.3 Contrast (Minimum), level AA. Rule color-contrast in axe-core.
What is wrong
The text colour is too close to the background colour. WCAG measures this as a contrast ratio between 1 to 1 (same colour) and 21 to 1 (black on white). Normal text needs at least 4.5 to 1. Large text needs at least 3 to 1; large means at least 24 px, or at least about 18.7 px when bold.
On shop sites the usual cases are light grey prices or shipping notes, white text on a light product photo, placeholder text in form fields, and small legal text in the footer.
Who it blocks
People with low vision, many older people, people with colour vision deficiency, and anyone reading on a phone in sunlight.
How to fix it
Keep the hue and make the text darker on a light background, or lighter on a dark background, until the ratio passes. For example, grey #999999 on white is 2.85 to 1; #767676 on white is 4.54 to 1 and passes.
/* before: 2.85 to 1 */
.price-note { color: #999999; }
/* after: 4.54 to 1 */
.price-note { color: #767676; }
For text over images, put the text on a solid or semi-opaque background, or add a dark overlay under it. A text shadow alone is not reliable.
Common mistakes
- Checking only the main colour and forgetting hover, focus and sale states. Controls that are really disabled are exempt, but a button that only looks disabled while it still works is not.
- Relying on the brand colour for small text. A brand colour that passes for large headings can fail for body text.
- Placeholder text used as the only instruction: it is usually light grey and fails.
How the scan proposes a fix
For each failing text, the scan reads the measured text and background colours, moves the text colour step by step toward black or white, and keeps the first colour that reaches the required ratio. It then checks that ratio again in the browser before showing it. When the background is an image or a gradient, the measured colour may be approximate, so check the result on the page.
Check your own pages for free
Drag this button onto your bookmarks bar: Scan with accessaudit. Then open a page of your shop and click the bookmark: a score and the three main defects appear in a few seconds. The check runs in your browser: no content of your page leaves it, only the scanner is downloaded from this site. Try it on a demo shop.