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. It covers how to measure contrast, which thresholds apply to ads, and where accessibility checks commonly go wrong in print and on screen.
Why contrast matters in ads
An ad is seen briefly, often at a distance, in poor light, or on a small screen. Low contrast between text and background is the most common reason a headline fails to register. Accessibility goes further than convenience. Roughly 1 in 12 men and 1 in 200 women have some form of colour vision deficiency, and many more people have low vision or view screens in bright sunlight.
Contrast problems cost you the message. If the headline or call to action cannot be read, the ad has no way to work, however good the layout is.
How contrast is measured
The Web Content Accessibility Guidelines (WCAG) 2.x define a contrast ratio between two colours. The ratio runs from 1:1 (identical colours) to 21:1 (black on white). It is based on relative luminance, which is a measure of how bright a colour appears to the eye. Green contributes most to perceived brightness, red less, and blue least.
The calculation works in three steps:
- Convert each sRGB channel (0 to 255) to a linear value.
- Weight the channels: 0.2126 for red, 0.7152 for green, 0.0722 for blue.
- Divide the lighter luminance plus 0.05 by the darker luminance plus 0.05.
The code below does this. It also adds a helper that reports which WCAG levels a pair of colours passes.
// 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);
}
// Report which WCAG levels a text/background pair passes.
function report(text, background, large = false) {
const ratio = contrastRatio(text, background);
const aa = large ? 3 : 4.5;
const aaa = large ? 4.5 : 7;
return {
ratio: Number(ratio.toFixed(2)),
AA: ratio >= aa,
AAA: ratio >= aaa,
};
}
console.log(contrastRatio([0, 0, 0], [255, 255, 255]).toFixed(1)); // 21.0
console.log(report([119, 119, 119], [255, 255, 255])); // { ratio: 4.48, AA: false, AAA: false }
console.log(report([118, 118, 118], [255, 255, 255])); // { ratio: 4.54, AA: true, AAA: false }The last two lines show how narrow the margin can be. A mid-grey of #777777 fails the 4.5:1 guideline on white, while #767676 passes. A difference of one step in each channel is invisible on a proof but changes the result.
Thresholds to design against
WCAG sets the following minimum ratios for text. These are written for web content, but they are a sound target for any ad.
| Content | Level AA | Level AAA |
|---|---|---|
| Normal text | 4.5:1 | 7:1 |
| Large text (about 24 px, or 19 px bold, and up) | 3:1 | 4.5:1 |
| Icons, button borders and other meaningful graphics | 3:1 | not defined |
| Logos and purely decorative elements | no requirement | no requirement |
Use AA as the working minimum. Aim for AAA on small supporting copy, such as legal lines, prices and dates, because that text is the smallest and the most likely to be read in poor conditions.
Logos are exempt from the WCAG rule, but brand guidelines usually specify a minimum contrast version of the logo (for example, a white reversed version for dark backgrounds). Use it.
Contrast is not only about the ratio
A passing ratio does not guarantee readable text. Several factors reduce legibility even when the number looks fine.
Text over photographs
A ratio is calculated between two flat colours, but a photograph has many. A headline can pass against the average colour of an image and still fail where a bright cloud or a dark shadow sits behind a letter. To handle this:
- Place text over a calm, even area of the image, or crop to create one.
- Add a solid or gradient overlay between the image and the text. A dark overlay at 40 to 60 percent opacity is a common starting point.
- Put the text in a solid panel or button shape.
- Check the ratio against the worst part of the background that sits behind the text, not the average.
Drop shadows and outer glows can help a little but are a weak fix. They soften letter edges and look dated, so use them only to support one of the methods above.
Thin weights and small sizes
Hairline and light type weights lose contrast because the strokes are thin and anti-aliasing blends them into the background. For small text, choose a regular or medium weight. A colour pair that passes for 24 px bold text may fail visually for 11 px light text, even though the formal rule is less strict for large type.
Gradients, patterns and transparency
Where the background changes, the contrast changes. Measure at the lowest-contrast point. Semi-transparent text is risky because the final colour depends on what is behind it. Avoid it for any text the viewer must read.
Colour is not the only signal
About 8 percent of men cannot reliably tell certain reds and greens apart. If an ad uses colour alone to carry meaning, those viewers miss it. Examples include a green "in stock" label next to a red "sold out" label, or a red price drop with no other marker.
Add a second signal:
- A text label ("Sold out", "Save 20%").
- An icon or shape.
- A difference in lightness, so the two colours differ in brightness as well as hue.
A quick test is to convert your design to greyscale. If the elements that must be told apart look the same, a viewer with colour vision deficiency may not tell them apart either. Most design tools can preview deuteranopia, protanopia and tritanopia (the three main types of colour blindness) as a soft proof or filter.
Print and screen differ
The same pair of colours does not behave the same way on paper and on a display.
| Factor | Screen | |
|---|---|---|
| Light source | Reflected room light | Emitted by the display |
| Darkest black | Limited by ink and paper, often lighter than on screen | Close to true black on OLED |
| Paper or display variation | Coated, uncoated and newsprint stocks change contrast | Brightness settings and glare change contrast |
| Small text risk | Ink spread (dot gain) fills in fine strokes | Anti-aliasing blurs fine strokes |
| Reversed text (light on dark) | Fine serifs and thin strokes can clog or fill in | Usually fine at normal sizes |
Practical consequences for print:
- On uncoated or newsprint stock, ink soaks in and darkens mid-tones, so light-grey text on a white page loses more contrast than you expect.
- Avoid reversed small text on a rich multi-ink background. If any plate is slightly out of register, the letters get coloured fringes and become harder to read. Use a single-plate or very simple colour behind small reversed type.
- Use a larger size and a bolder weight for reversed type than you would for dark-on-light.
For screens, check in dark mode and at low brightness if the placement may appear there. Some social platforms and apps apply their own colour inversion, which can change how your ad looks.
Beyond colour: other accessibility points
Contrast is one part of accessible ad design. The following also affect whether people can use your ad.
- Text size. Keep body copy at a size that can be read at the viewing distance. As a rule for digital ads, avoid text smaller than about 11 to 12 px at the ad's native size. Check platform minimums too, since some networks restrict the share of the image that text may cover.
- Alt text. For digital placements, give every image a text alternative that conveys the message. The HTML banner from the digital chapter does this with the
altattribute:alt="Spring Sale: 20% off". Alt text should repeat the information in the ad, not describe the artwork ("blue banner with flowers"). - Animation. Flashing more than three times per second can trigger seizures. Avoid it. Where a banner loops, limit the loop count and keep it short, and let viewers pause moving content on platforms that allow it.
- Link and button targets. A call to action button on a mobile ad should be large enough to tap, around 44 by 44 px or more.
- Plain language. Short words and sentences help everyone, including viewers with reading difficulties or who are reading in a second language.
- Video. Provide captions, because many viewers watch muted.
A workflow for checking an ad
The diagram shows a repeatable check. Run it on the master design and again on each resized variant.
Common errors
- Checking only the headline. Legal lines, prices and button labels are usually the smallest and weakest text.
- Measuring once on the master. Resizing can move text onto a different part of an image, which changes the contrast.
- Trusting the screen for print. A bright monitor makes pale colours look stronger than they will on uncoated paper.
- Using brand colours without testing them. Many brand palettes include pairs that fail 4.5:1. Agree with the brand owner on approved text and background combinations, and note them in the style guide.
- Relying on a tool without looking. A pass from a checker is a minimum. Look at the ad at actual size, at arm's length for print and on a phone for digital.
Exercises
Exercise
A white headline sits over a photo. The ratio against the photo's average colour is 5.1:1, but part of the sky behind the first word is much lighter. What should you do, and why?
Show answer
Measure the ratio against the lightest area that sits behind the text, because that is where the text is hardest to read. If it falls below 4.5:1 (or 3:1 for large text), add a dark overlay or gradient behind the headline, move or crop the image so the text sits on a calmer area, or place the text in a solid panel. The average colour hides local failures.
Exercise
Using the contrastRatio function in this chapter, what is the ratio for text [118, 118, 118] on a white background, and does it meet WCAG AA for normal-size text?
Show answer
The ratio is about 4.54:1. It meets AA for normal text (4.5:1 or higher) but not AAA (7:1). The colour #777777, which is [119, 119, 119], gives about 4.48:1 and fails AA.
Exercise
A sale ad shows "In stock" in green and "Sold out" in red, with no other differences. Name the problem and give two fixes.
Show answer
The ad uses colour alone to carry meaning, so viewers with red-green colour vision deficiency may not tell the two labels apart. Fixes: keep the text labels as the primary signal and make sure they are always present, add an icon or shape (such as a tick and a cross), or choose colours that differ clearly in lightness as well as hue. Check the result in greyscale.