Sub topic 8
Contrast and accessible ad design
This chapter assumes you can set type and colour in a design tool, know the difference between RGB and CMYK, and have read the earlier chapters on typography and colour modes. Here you will check that people can read your ad, in print and on screen.
Why contrast matters in ads
An ad gets a second or two of attention. If the headline blends into the background, the message is lost. Low contrast also hurts people with low vision or colour-vision deficiency, and it hurts everyone reading in bright sunlight or on a dim phone screen.
Contrast is the difference in brightness between two colours, usually text and its background. Hue matters less than brightness. Red text on a green background can look vivid and still be unreadable for some viewers, because the two colours have similar brightness.
The WCAG contrast ratio
The Web Content Accessibility Guidelines (WCAG) measure contrast as a ratio from 1:1 (no difference) to 21:1 (black on white). These are the usual targets:
| Content | Minimum ratio (level AA) |
|---|---|
| Normal text | 4.5:1 |
| Large text (about 24 px, or 18.66 px bold, and up) | 3:1 |
| Logos and decorative text | No requirement |
| Buttons and key graphics | 3:1 |
Ads are not always legally bound by WCAG, but it is the standard measure. Use 4.5:1 for headlines, body copy and call-to-action (CTA) text as a working rule.
The ratio comes from the relative luminance of each colour. This script computes it.
// WCAG 2.x contrast ratio between two sRGB colours given as [r, g, b] (0-255).
function luminance([r, g, b]) {
const lin = (v) => {
const c = v / 255;
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
};
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
}
function contrastRatio(a, b) {
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
return (hi + 0.05) / (lo + 0.05);
}
console.log(contrastRatio([0, 0, 0], [255, 255, 255]).toFixed(1)); // 21.0The function sorts the two luminance values so the lighter colour is always on top. The 0.05 terms stop the ratio from becoming infinite with pure black.
Worked example
Suppose a banner has white text on an orange button, [240, 120, 20]. Run contrastRatio([255, 255, 255], [240, 120, 20]) and you get roughly 2.9:1. That fails the 4.5:1 target. Darkening the orange to [200, 80, 0] raises the ratio above 4.5:1 and keeps the brand feel. Another fix is to switch the button text to a dark colour.
Common errors
- Text placed directly on a photo. Brightness varies across the image, so contrast changes along the line. Add a solid or semi-transparent panel, a gradient overlay, or move the text to a calm area.
- Light grey text for legal lines. Small text needs more contrast, not less.
- Relying on colour alone. A red "sale" price and a green "regular" price look the same to some viewers. Add a label, strike-through or position difference.
- Thin, light type on coloured backgrounds. Thin strokes lose contrast when printed or scaled down.
- Checking only the design file. Test the exported file at real size.
Other accessibility habits
- Write alt text for digital placements, such as the
altattribute on the banner image. Include the offer and CTA words that appear in the image. - Keep animated banners short, with no flashing faster than three times per second.
- Make the CTA large enough to tap, around 44 by 44 px on mobile.
- View your design in greyscale. If the hierarchy still reads, the contrast is probably working.
Exercise
A banner uses white 14 px body text on a light blue background, and the measured contrast ratio is 3.2:1. Does it meet the guideline, and what are two ways to fix it?
Show answer
No. Normal-size text needs 4.5:1, and 14 px text is not large text, so 3.2:1 fails. Fix it by darkening the background (or switching to dark text), or by placing the text on a darker solid panel. Raising the text size to the large-text range would lower the requirement to 3:1, but that is rarely practical for body copy in a small banner.
Exercise
Why is a red price next to a green price a risky way to show "sale" versus "regular"?
Show answer
Some viewers with colour-vision deficiency see the two colours as similar in brightness and hue, so the difference is lost. Add a second cue, such as a "Sale" label, a strike-through on the old price, or different type weight and size.