Text over a photo or gradient has no single background colour, so a single contrast check can lie. The ratio may pass where the gradient is dark and fail where it is light, within the same headline. The safe check measures the worst patch, not the average.
Why this needs its own check
WebAIM’s contrast guide states the WCAG minimum of 4.5 to 1 for normal text and 3 to 1 for large text, and notes that text over a photo or gradient needs a solid-colour or gradient scrim behind it, or a check against the worst-case patch of the image rather than one spot. A single spot check is not enough.
What you need before you start
- The design with text over a gradient or photo
- A contrast checker such as the WebAIM Contrast Checker
- The exact text and background colours at the lightest and darkest patches
Step 1 – Sample the lightest and darkest patches
Look at the gradient behind the text and pick the lightest patch the text touches and the darkest patch it touches. Write down the colour of each patch.
Step 2 – Measure both ratios
Measure the text colour against each patch. The text must clear 4.5 to 1 for normal text, or 3 to 1 for large text, against both patches. If either patch fails, the text fails.
Step 3 – Add a scrim where it fails
Put a solid or gradient scrim behind the text so the background is even, then measure again. A scrim that only fixes the middle of the text does not count.
Worked example
Practice check: a fictional Alder and Ash Architects hero banner
The example below is fictional. Alder and Ash Architects is an invented business used only as a practice case. No real customer, page, or product is shown. Treat it as a practice case, not as evidence about any real business.
| Part | What it should be | As shown | Result |
|---|---|---|---|
| Headline on dark patch | 3 to 1 or better for large text | White on dark patch, 12.6 to 1 | Pass |
| Headline on light patch | 3 to 1 or better for large text | White on light patch, 1.9 to 1 | Fail – 1.9 to 1 |
| Button label on dark patch | 4.5 to 1 or better | White on dark patch, 12.6 to 1 | Pass |
| Button label on light patch | 4.5 to 1 or better | White on light patch, 1.9 to 1 | Fail – 1.9 to 1 |
Only 2 of the 4 checks pass: the headline and the button label on the dark patch. The two failures are the same texts on the light patch, at 1.9 to 1.
What to do when something is wrong
Add a dark gradient scrim behind the whole text block so the lightest patch behind the text is dark enough, then re-measure both ends. Do not lighten the text alone, since that breaks the dark end.
Expected result. We checked the WebAIM contrast guide listed in Sources. We did not measure a live Alder and Ash Architects banner. UNTESTED: no contrast checker was run on a real design; the practice ratios 12.6 to 1 and 1.9 to 1 are practice values for the fictional banner.
Limits
- This check covers text over gradients and photos only. It does not cover text over video, where the background moves, or text over patterns.
Sources
- WebAIM – Contrast and Color Accessibility (checked 2026-11-29)
