Color & Contrast

Color Blindness Considerations

15 min read

Designing for Color Blindness

Approximately 8% of men and 0.5% of women have some form of color vision deficiency. Designing with color blindness in mind ensures your content is accessible to millions more users. This guide explains the different types of color blindness and provides practical strategies for inclusive design.

Types of Color Blindness

Deuteranomaly (Most Common)

Affects: ~6% of males

Impact: Reduced sensitivity to green light; red and green appear similar

People with deuteranomaly see:

  • Red and green as brownish-yellow
  • Difficulty distinguishing between these colors
  • Blues and yellows remain relatively distinct

Protanomaly/Protanopia

Affects: ~2% of males

Impact: Reduced or no sensitivity to red light

People with protanopia see:

  • Red appears darker, almost black
  • Orange, yellow, and green appear similar
  • Blue and purple remain relatively distinct

Tritanomaly/Tritanopia (Rare)

Affects: <0.01% of population

Impact: Reduced or no sensitivity to blue light

People with tritanopia see:

  • Blue appears greenish
  • Yellow and pink appear similar
  • Difficulty distinguishing blue from green

Achromatopsia (Very Rare)

Affects: ~0.003% of population

Impact: Complete inability to see color

People with achromatopsia see:

  • Everything in shades of gray
  • Often have light sensitivity
  • May have reduced visual acuity

The Golden Rule: Never Rely on Color Alone

WCAG 1.4.1 states that color should not be the only visual means of conveying information. Here's why and how to comply:

Bad: Color-Only Status Indicators

html
<!-- Bad: Status only indicated by color -->
<span class="status-green">Connected</span>
<span class="status-red">Disconnected</span>
<span class="status-yellow">Connecting</span>

<style>
  .status-green { color: #22c55e; }
  .status-red { color: #ef4444; }
  .status-yellow { color: #eab308; }
</style>

Good: Color + Additional Indicators

html
<!-- Good: Color plus icon and/or text -->
<span class="status-green">
  <svg aria-hidden="true"><!-- checkmark icon --></svg>
  Connected
</span>
<span class="status-red">
  <svg aria-hidden="true"><!-- x icon --></svg>
  Disconnected
</span>
<span class="status-yellow">
  <svg aria-hidden="true"><!-- spinner icon --></svg>
  Connecting...
</span>

Practical Design Strategies

1. Use Patterns and Textures

In charts and graphs, combine color with patterns:

css
/* Chart bars with distinct patterns */
.bar-sales {
  background-color: #3b82f6;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(255,255,255,0.2) 5px,
    rgba(255,255,255,0.2) 10px
  );
}

.bar-expenses {
  background-color: #ef4444;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(255,255,255,0.2) 5px,
    rgba(255,255,255,0.2) 10px
  );
}

.bar-profit {
  background-color: #22c55e;
  /* Solid - no pattern */
}

2. Add Icons to Color-Coded Elements

jsx
function Alert({ type, children }) {
  const icons = {
    success: <CheckCircle className="text-green-600" />,
    warning: <AlertTriangle className="text-yellow-600" />,
    error: <XCircle className="text-red-600" />,
    info: <Info className="text-blue-600" />
  };

  return (
    <div className={`alert alert-${type}`}>
      {icons[type]}
      <span>{children}</span>
    </div>
  );
}

3. Use Direct Labels

Instead of relying on a color legend:

jsx
// Bad: Requires matching colors to legend
<LineChart>
  <Line stroke="#3b82f6" data={salesData} />
  <Line stroke="#ef4444" data={expensesData} />
  <Legend />
</LineChart>

// Good: Direct labels on lines
<LineChart>
  <Line stroke="#3b82f6" data={salesData}>
    <Label position="end">Sales</Label>
  </Line>
  <Line stroke="#ef4444" data={expensesData}>
    <Label position="end">Expenses</Label>
  </Line>
</LineChart>

4. Choose Color-Blind-Friendly Palettes

Some color combinations work better than others:

Good combinations:

  • Blue and orange
  • Blue and yellow
  • Purple and yellow
  • Black, white, and gray with one accent color

Avoid:

  • Red and green together
  • Green and brown
  • Blue and purple without other distinguishing features
  • Light green and yellow

5. Consider Color Blindness in Form Validation

css
/* Validation with multiple indicators */
.input-error {
  border-color: #ef4444;
  border-width: 2px;
  background-image: url("data:image/svg+xml,..."); /* error icon */
  background-position: right 12px center;
}

.input-success {
  border-color: #22c55e;
  border-width: 2px;
  background-image: url("data:image/svg+xml,..."); /* check icon */
  background-position: right 12px center;
}

.error-message {
  color: #ef4444;
}
.error-message::before {
  content: "⚠ "; /* Text indicator */
}

Testing for Color Blindness

Browser Extensions

  • Colorblindly: Chrome extension simulating different types
  • NoCoffee: Vision simulation including color blindness

Design Tool Features

Most design tools have built-in simulation:

  • Figma: View > Color Blindness Simulation
  • Adobe Color: Accessibility Tools panel
  • Sketch: Plugins like Stark

Code-Based Simulation

javascript
// Using canvas to simulate deuteranopia
function simulateDeuteranopia(imageData) {
  const data = imageData.data;
  for (let i = 0; i < data.length; i += 4) {
    const r = data[i];
    const g = data[i + 1];
    const b = data[i + 2];
    
    // Deuteranopia simulation matrix
    data[i] = r * 0.625 + g * 0.375;
    data[i + 1] = r * 0.7 + g * 0.3;
    data[i + 2] = b;
  }
  return imageData;
}

Checklist for Color-Blind Accessible Design

  • Color is never the sole indicator of meaning
  • Important elements have sufficient contrast
  • Charts and graphs use patterns or direct labels
  • Error states include icons or text, not just color
  • Links are distinguishable by more than color
  • Interactive elements have visible focus indicators
  • Color palette tested with simulation tools

Was this article helpful?