Contrast Checker for Text Over Images
Headlines on hero photos look great in mockups and often fail in real life, because a photo has many colors at once. Sample the worst part of the image behind your text and test against that. An overlay usually solves the problem without hiding the photo.
Test the worst spot, not the average
A contrast checker compares two flat colors, while a photo behind text contains hundreds. The honest approach is to find the part of the image behind your text that is closest to the text color, such as the brightest sky behind white text, and use that color as the background. If the text passes there, it passes everywhere. Use an eyedropper in your design or image editor to grab the hex value, then paste it into the background field.
Remember the image may be cropped differently on phones, so the area behind your headline can change between screen sizes.
Overlays make contrast predictable
The reliable fix is a semi-transparent dark overlay or gradient between the photo and the text. After adding it, sample the lightest point again and recheck. Other options include placing text on a solid panel over the image, adding a subtle text shadow, or choosing photos with a calm, even area where the text sits. Large hero headlines only need 3:1 if they are at least 24px, but the smaller subheading and button below them still need 4.5:1.
Questions
How do I check contrast on a photo?
Pick the color in the photo behind your text that gives the lowest contrast, usually the lightest area under white text or the darkest under black text. Sample its hex code with an eyedropper and test that pair. Passing against the worst point means the text is readable across the image.
Does a text shadow count?
A shadow or outline can help by creating a contrasting edge around each letter, and WCAG guidance accepts that approach when it is strong enough. Subtle soft shadows often are not. An overlay or solid panel behind the text is easier to verify and works more consistently across images.
What about text in a background video?
The background keeps changing, so test the frame where contrast is lowest. A dark overlay across the whole video is the practical fix. Also give people a way to pause moving backgrounds, which WCAG requires for motion that plays longer than five seconds.
Get a beautiful, accessible interface designed by VYZEON.
See UI/UX design