An even layer
—
The overlay color over the whole picture, at one strength.
Working it out…
In use now
WCAG 2.2 contrast on a photo
A photo behind text has thousands of colors, and the text has to read against the weakest of them. Put text on an example or on your own image: every pixel behind it is measured, the weakest spot is marked, and the lightest overlay that fixes it is worked out.
The workbench
Pick an example or use your own image, then move the text, change it and try an overlay. Every change is measured again at once.
The workbench needs JavaScript to read an image. The worked examples below read without it.
This browser cannot read that file as an image.
These four pictures are drawn by code rather than photographed, so every figure on this page can be checked.
Bright sky with clouds 1200 × 750 px
Measuring…
Drop the image to measure text on it
1.00:1
Fails Large text needs 3:1 AA
How the measured pixels spread
Weakest pixel #FFFFFF
Some of the text runs outside its frame, and the frame measurement leaves it out.
The fixes
Each fix is worked out for the text and frame above, from the picture without any overlay, one whole percent at a time. Use one to see it on the picture.
—
The overlay color over the whole picture, at one strength.
Working it out…
In use now
—
Strongest at the edge nearer the text and clear at its reach, so more of the picture stays bright.
Working it out…
In use now
White or black text on the same pixels, under the overlay as it is.
The overlay as a layer on the picture's box, and the text above it. It follows the controls above.
Worked examples
Each example is measured over its whole text frame at 1200 pixels wide, at level AA, with no overlay; then the lightest black layer and fade that pass are worked out. Open one in the workbench to change anything.
| Picture | Text | Needs | Lowest | Median | Pixels that pass | Even black layer | Black fade | Workbench |
|---|---|---|---|---|---|---|---|---|
| Bright sky with clouds | Plan your summer#FFFFFF 56 px Bold | 3:1 | 1.00:1 | 1.95:1 | 11% | 42% | From the top: none passes | |
| Sunset over water | Evening boat tours#FFFFFF 64 px Bold | 3:1 | 1.47:1 | 5.60:1 | 97% | 30% | From the bottom: 60% | |
| Leaves in dappled light | Explore the trails#FFFFFF 48 px Bold | 3:1 | 1.84:1 | 8.39:1 | 96% | 23% | From the bottom: 47% | |
| City lights at night | Open until midnight#FFF4D6 20 px Regular | 4.5:1 | 2.55:1 | 16.25:1 | 74% | 27% | From the top: 37% |
The fades reach 60% of the picture's height, from the edge nearer the text.
Method
The worked examples are recomputed by an automated test from the same code, so a figure on this page cannot drift from what the workbench measures.
Found a wrong number? Tell us.
Limits
In practice
The rules: 1.4.3 Contrast (Minimum), 1.4.6 Contrast (Enhanced) and 1.4.5 Images of Text.
Where next
From one picture to every pair on a page.