Colour
Colour you can read
Contrast is a relationship. Start with the text and test the pairs you actually use.
A colour cannot be judged in isolation. A pale grey may be easy to read against white in a large heading and almost invisible in a small caption. The useful unit is the pair: foreground and background, at the size you use them.
Begin with the quietest text
It is tempting to choose the headline colour first. Instead, test the secondary text: captions, dates, field hints and navigation. These are often the places where a restrained palette becomes difficult to read.
Keep a record of the actual foreground and background pairs. “Dark grey” is not specific enough to reproduce a decision later.
:root {
--text: #182b36;
--text-secondary: #5c6c76;
--page: #f8faf9;
--surface: #eaf0ee;
}Check contrast in context
Use a contrast checker for text colours, and then inspect the result in the real page. Thin strokes, a small typeface and a long reading distance can make a technically acceptable pair feel weaker than you expected.
WCAG's usual AA threshold is 4.5:1 for normal text and 3:1 for large text. That is a starting requirement, not a reason to make every pair as faint as the threshold allows. A little extra contrast gives the design more tolerance.
Do not ask colour to work alone
A selected item needs more than a changed hue. Add a label, underline, border or shape. The same applies to an error message or a status. Someone should be able to understand the meaning without having to distinguish red from green.
| Situation | A second cue |
|---|---|
| Link in a paragraph | Underline |
| Current navigation item | Underline and position |
| Invalid input | Written explanation |
| Selected option | Check mark or border |
A useful test: view the page in greyscale. The mood will change, but navigation, selection and important messages should still make sense.
Test the less ideal screen
Look at the page on a phone in daylight and on a laptop at lower brightness. A palette should survive ordinary viewing conditions, not only the display where it was designed.
Save a small set of colour roles, test the combinations you permit, and reuse those roles. This gives future pages a reliable starting point.
Further reading: W3C: understanding minimum contrast.