Skip to content

Latest commit

 

History

History
242 lines (183 loc) · 6.22 KB

File metadata and controls

242 lines (183 loc) · 6.22 KB

Color-Blind Safe Outcomes - Quick Reference

TL;DR

Predictify now uses color + pattern + shape to distinguish outcomes, making them accessible to users with color-vision deficiency (CVD).


One-Minute Overview

The Problem

Red-green color-blindness (deuteranopia) affects ~1% of users. Red/green alone isn't sufficient.

The Solution

  1. HSL Chart Colors - WCAG-AA contrast darkened colors (light/dark mode)
  2. Geometric Patterns - Diagonal, dots, crosshatch, horizontal, vertical lines
  3. SVG Icons - Triangle Up (✓), Triangle Down (✗), Diamond (○)

The Result

Outcomes are now distinguishable by color, shape, pattern, AND text. ✅


Using OutcomeChip

import { OutcomeChip } from '@/components/ui/OutcomeChip'

// 5 Outcomes
<OutcomeChip variant="positive">Won</OutcomeChip>      // ▲ Burnt-orange diagonal
<OutcomeChip variant="negative">Lost</OutcomeChip>      //  Teal dots
<OutcomeChip variant="neutral">Pending</OutcomeChip>    //  Steel crosshatch
<OutcomeChip variant="tie">Tied</OutcomeChip>           // Amber horizontal
<OutcomeChip variant="dispute">Disputed</OutcomeChip>   // Rust vertical

Outcome Palette

Variant Icon Color (Light) Color (Dark) Pattern Use Case
positive Burnt-orange Blue Diagonal Yes / Won
negative Teal Cyan Dots No / Lost
neutral Steel Orange Crosshatch Pending / Active
tie Amber Purple Horizontal Tie / Draw
dispute Rust Magenta Vertical Disputed / Alert

CSS Classes

Color Tokens (from Tailwind)

bg-chart-1  /* positive → your chart color 1 */
bg-chart-2  /* negative → your chart color 2 */
bg-chart-3  /* neutral → your chart color 3 */
bg-chart-4  /* tie → your chart color 4 */
bg-chart-5  /* dispute → your chart color 5 */

Pattern Overlays

pattern-diagonal      /* 45° diagonal lines */
pattern-dots          /* • dot grid */
pattern-crosshatch    /* # grid overlay */
pattern-horizontal    /* ≡ horizontal stripes */
pattern-vertical      /* ║ vertical stripes */

Verification Checklist

For Developers

  • Using OutcomeChip for all outcome states? ✓
  • Every variant has a distinct chart color? ✓
  • Every variant has a distinct pattern? ✓
  • Text labels always present? ✓
  • Aria-labels for screen readers? ✓

For Designers

  • Outcomes visually distinct in light mode? ✓
  • Outcomes visually distinct in dark mode? ✓
  • High-contrast mode accessible? ✓
  • Tested under vision deficiency simulation? ✓

For QA

  1. Open Chrome DevTools → Rendering tab
  2. Find Emulate vision deficiencies
  3. Test each:
    • ✓ Deuteranopia (red-green blind)
    • ✓ Tritanopia (blue-yellow blind)
    • ✓ Achromatopsia (completely color-blind)
  4. Verify: Icons distinct, patterns visible, text readable

Common Questions

Q: Can I customize the colors?

A: Yes! Use the chartClass prop:

<OutcomeChip variant="positive" chartClass="bg-chart-5">
  Custom color
</OutcomeChip>

Q: Can I use different patterns?

A: Yes! Use the patternClass prop:

<OutcomeChip variant="positive" patternClass="pattern-dots">
  Different pattern
</OutcomeChip>

Q: What if I just want the pattern overlay?

A: Add the pattern class to any element:

<div className="bg-chart-1 pattern-diagonal">Outcome</div>

Q: Does it work in dark mode?

A: Yes! Colors and patterns automatically adapt via CSS variables.

Q: Are the icons automatically included?

A: No. Import separately:

import { OutcomeIcon } from '@/components/icons/OutcomeIcons'
<OutcomeIcon variant="positive" aria-hidden />

Q: What about accessibility?

A: Built-in:

  • ✅ WCAG 2.1 AA contrast
  • ✅ Semantic HTML (role, aria-label)
  • ✅ Keyboard navigation
  • ✅ Screen reader friendly

File Locations

What Where
Component components/ui/OutcomeChip.tsx
Patterns CSS app/styles/patterns.css
Color tokens styles/globals.css (chart section)
Icons components/icons/OutcomeIcons.tsx
Tests components/ui/__tests__/OutcomeChip.test.tsx
Design docs app/design-system/tokens.md

Testing

# Run OutcomeChip tests
npm run test -- OutcomeChip --run

# Check all tests
npm run test

# Lint check
npm run lint

# Type check
npm run type-check

Real-World Examples

PredictionCard Status Badge

// Shows outcome: Won, Lost, or Pending
<OutcomeChip variant={getOutcomeVariant(prediction.status)}>
  {prediction.status}
</OutcomeChip>

Dispute Vote Tally

// Show both option as distinct
<div className="flex gap-2">
  <OutcomeChip variant="positive">42% Yes</OutcomeChip>
  <OutcomeChip variant="negative">58% No</OutcomeChip>
</div>

Status Badge

// Market status
<OutcomeChip variant={getStatusVariant(market.status)}>
  {market.status}
</OutcomeChip>

Key Principles

  1. Never use color alone - Always pair with pattern or shape
  2. Test with vision deficiency simulation - Chrome DevTools, 30 seconds
  3. Keep text labels - They're the primary accessible name
  4. Respect reduced motion - Patterns use CSS, not animations
  5. Theme aware - Light, dark, and high-contrast modes supported

Standards Compliance

  • WCAG 2.1 AA Level (international web accessibility standard)
  • WCAG 2.1 AAA for high-contrast mode
  • ADA Compliant (US accessibility law)
  • EN 301 549 (European accessibility standard)

Performance

  • 🚀 Zero JavaScript for patterns
  • 🚀 GPU Accelerated CSS gradients
  • 🚀 Automatic Scaling (no media queries)
  • 🚀 Theme Efficient (CSS variables)

Learn More

  • Full Implementation Guide: COLORBLIND_OUTCOMES_IMPLEMENTATION.md
  • Issue Resolution: ISSUE_435_RESOLUTION_SUMMARY.md
  • Design System: app/design-system/tokens.md
  • Tests: components/ui/__tests__/OutcomeChip.test.tsx

Quick Links:

  • Issue: #435 ✅ Resolved
  • PR: [Link to PR]
  • Review: Required before merge

Last Updated: July 26, 2026