Designing for Color Vision Deficiency
About 1 in 12 men and 1 in 200 women have some form of color vision deficiency (CVD). Those are the commonly cited figures for people of Northern European descent, and rates are lower in some other populations. On a team of thirty or a product with thousands of users, you should assume some of them see your color choices differently than you intend. This post covers how to catch the failures before they do.
The most common failure: status badges
"Green means success, red means error" is the default pattern almost everywhere. With red-green CVD, the two hues can look very similar, often as similar yellow-browns. A table of API requests with green rows for success and red rows for errors can become unreadable for those users.
The fix is small. Add an icon next to the color: ✓ for success, ✗ for error. Add a text label: "Success" or "Error". Now the meaning is carried twice, and it survives even if the color does not. That is the main principle of accessible color use: color is never the only encoding. WCAG states this in success criterion 1.4.1, Use of Color.
Types of CVD
Color vision depends on three kinds of cone cell, sensitive to long (L), medium (M), and short (S) wavelengths. CVD comes from a missing or altered cone type. Commonly cited prevalence figures:
- Protanopia (about 1% of men): no working L cones. Reds look darker, and red and green are confused.
- Protanomaly (about 1% of men): altered L cones, a milder form of the same problem.
- Deuteranopia (about 1% of men): no working M cones. Red and green are confused.
- Deuteranomaly (about 5% of men): altered M cones. This is the most common type.
- Tritanopia and tritanomaly (rare, well under 0.1%): altered or missing S cones. Blue and yellow are confused.
- Achromatopsia (about 1 in 30,000 people): little or no color vision at all.
The milder "-omaly" forms are the most common and the hardest to test for, because people with them see most things normally and have trouble only with specific colors.
The color blindness simulator on this site shows an image as it might appear with protanopia, deuteranopia, tritanopia, and achromatopsia. Those panels show the strongest form of each condition, so treat them as a worst case.
Patterns that work
1. Icon, text, and color together
For every status, alert, or category that uses color, add an icon and a text label. The icon and text carry the meaning, and the color reinforces it.
<!-- Color is the only signal --> <span class="dot red"></span> <!-- Icon and text carry the meaning --> <span class="badge danger">✗ Down</span>
2. Choose palettes designed for it
Viridis was designed to be perceptually uniform and readable with common forms of CVD, and Cividis was optimized specifically for it. ColorBrewer marks which of its palettes are colorblind-safe. Avoid red-yellow-green scales and rainbow palettes for data.
3. Add shape, position, or pattern
In line charts, separate series with line style (solid, dashed, dotted) as well as color. In scatter plots, use different marker shapes. In bar charts, position already carries the value, so color can be left as an accent.
4. Test contrast separately
Low contrast and CVD are separate problems, and a design can fail either one alone. Run the contrast checker for WCAG ratios, then look at the design in the simulator. A pair of colors passing one check says nothing about the other.
5. Make states differ in lightness, not only hue
OKLCH (covered in the CSS color post) makes it easy to give colors the same perceived lightness, and it is tempting to build status colors that way. For CVD that is the wrong goal. If oklch(60% 0.2 30) is your error color and oklch(60% 0.2 140) is your success color, the only difference between them is hue, which is the one thing red-green CVD removes. If two states have to be told apart by color alone, separate them in lightness as well, and better still, add an icon.
Specific high-stakes patterns
Form validation
A red border on an invalid field is not enough. Add an icon (⚠) and a text message such as "Enter a valid email address". The icon works without color perception, the text also works with screen readers, and the color is reinforcement.
Charts and graphs
The hardest case is a multi-line chart with a small legend mapping colors to series names, because CVD users may not be able to match them. Label each line directly, near its right-hand end, and consider different line styles.
Heatmaps
Sequential heatmaps (light to dark in one hue, or Viridis) keep their meaning because lightness carries the value. Red-to-green diverging heatmaps do not. If you need a diverging scale, blue-to-orange is a safer pair.
Required field markers
A red asterisk relies on people knowing what it means, and pure red can look dark and hard to see with protanopia. Write the word "required" in the label.
Dark themes
Dark themes do not fix CVD problems, and they change which color pairs are hard to separate. Test the light and dark themes separately.
A quick check for new UI
- Take a screenshot of the new color-coded element.
- Load it into the simulator and look at each panel.
- If two states look alike in any panel, add an icon or text label.
- Check the text and background pairs with the contrast checker.
Chrome DevTools can also emulate vision deficiencies on a live page, under the Rendering panel, which is useful for hover states and other things a screenshot misses.