A palette usually begins with feeling. A photograph of a place, a material, a mood. That is as it should be, and nothing here is meant to replace it.

But once chosen, colours have to do jobs. They must separate text from its background, distinguish one thing from another, and signal what can be pressed and what has gone wrong. Whether they succeed is a question with numerical answers, and the answers are easy to obtain.

The eyes of the audience

About eight per cent of men and half a per cent of women of northern European descent have some form of colour-vision deficiency. The rates vary somewhat between populations and are in the same range across much of the world. In a room of thirty people, expect one or two.

Nearly all of them have the red-green kind. They are not without colour vision. They have difficulty separating certain reds, greens, oranges and browns, which can look like versions of the same murky tone. A much rarer form affects blue and yellow, and complete absence of colour vision is very rare indeed.

Then there is age. The lens of the eye yellows and the pupil shrinks over the decades, so that less light reaches the retina. A person of sixty needs considerably more contrast than a person of twenty to read the same text. Add low vision from other causes, and add everyone who has ever tried to read a phone on a sunny street, and "people who need good contrast" comes to include nearly the whole audience at one time or another.

Contrast as a number

The Web Content Accessibility Guidelines, the international standard, define contrast as a ratio between the relative brightness of two colours. Black on white is 21 to 1, the maximum. Two identical colours are 1 to 1.

The thresholds worth remembering:

Use Minimum ratio
Normal body text 4.5 : 1
Large text, roughly 24 px or 19 px bold 3 : 1
Icons, form borders, parts of charts 3 : 1
A stricter level for body text 7 : 1

These are minimums. Body text at 4.5 to 1 is legal and still not comfortable for many people.

The calculation depends on brightness alone. Hue plays no part. This catches people out. A saturated red and a saturated green of similar brightness can look violently different to most eyes and have a contrast ratio near 1 to 1. To someone with a red-green deficiency, or on a greyscale print, they are the same.

Some results surprise designers the first time they check. White text on a mid-orange or a bright yellow-green fails. So does white on many popular light blues. A fashionable mid-grey on white, the kind often used for secondary text, tends to fall just short. Pure yellow can only carry dark text.

Any number of free tools will compute the ratio for two colour codes. Checking a palette of six colours against each other takes five minutes.

Never colour alone

The second rule matters as much as contrast and is broken more often. Colour must not be the only means of conveying something.

Consider a form in which a required field left empty acquires a red border. To a reader who cannot tell that red from the grey of the other borders, nothing has happened. Add an icon and a line of text saying what is wrong, and the problem disappears.

The same goes elsewhere:

  • Links in running text need an underline or another mark besides colour.
  • Status: a green dot and a red dot are the same dot to many people. Use a tick and a cross, or the words.
  • Charts: lines told apart by colour alone are a puzzle. Label the lines directly, vary the dash pattern or the marker shape.
  • Maps and diagrams: add pattern, texture or labels.

A useful test is to ask whether the design would still work printed on a black-and-white laser printer. If it would, it works for nearly everyone.

Seeing what others see

Most design software, and the developer tools in every major browser, can simulate the common forms of colour-vision deficiency. Switching the view takes one click.

It is an instructive few minutes. A carefully balanced palette of terracotta, olive and rust may collapse into three similar browns. A red "error" and a green "success" become indistinguishable. A heat map running from green to red turns into a single muddy ramp.

A greyscale view is the other quick check. It shows the palette as brightness alone, which is what the contrast ratio measures, and reveals at once which colours are doing the same job.

Building a palette that holds up

The practical method is to treat brightness as the structure of the palette and hue as its character.

Vary lightness, not only hue. A set of colours at five clearly different levels of lightness will remain distinct to any eye. A set of five hues at the same lightness will not.

Avoid the troublesome pairs for anything that matters. Red against green, green against brown, blue against purple, and light green against yellow are the classic confusions. If two colours must be told apart to understand something, do not choose them from the same list.

Blue and orange are safe companions. They stay distinct under all the common deficiencies. That is one reason so many charts use them.

Define the pairs. A brand palette is more useful as a table of approved combinations, such as this text colour on that background at this size, than as a row of swatches. It prevents the accent colour being used for body text by someone in a hurry.

Keep a text-safe version of the accent. Many accent colours are too light to carry text or to be text. A darker shade of the same hue, reserved for those uses, solves it without changing the feel.

For charts and maps there is a well-established resource: sets of colours designed by the cartographer Cynthia Brewer and tested for legibility and for colour-blind readers. There is also a family of colour scales, developed for scientific software, that increase evenly in brightness and remain readable in greyscale. Both are free.

Dark mode

A dark background is not a white one inverted. Pure white text on pure black glares, and can blur for people with astigmatism. Most well-made dark schemes use an off-white on a very dark grey. Saturated colours that looked calm on white become fierce on black and usually need softening. Every pair has to be checked again.

The other half of colour

Meaning is the part no ratio can check. Red signals danger or error in much of the world and good fortune in China, where rising share prices are shown in red. White is for weddings in some cultures and for mourning in others. An identity meant for international use deserves a conversation with people from the places it will go.

A fifteen-minute routine

  1. List every pairing of text and background in the design. Check each ratio. Fix or forbid those below 4.5 to 1.
  2. Switch to greyscale. Confirm that everything important is still distinct.
  3. Switch on a red-green simulation. Look at states, charts and links.
  4. Find every place where colour alone carries meaning. Add a second signal.
  5. Take the design outdoors on a phone.

None of this constrains the feeling that began the palette. A good many striking identities pass every one of these checks. A handsome palette that a twelfth of the men looking at it cannot read still needs more work.