Accessibility

The contrast matrix helps you ensure your color combinations meet WCAG accessibility standards for text readability.

Explanation of Contrast Ratio

Contrast ratio measures the difference in luminance (brightness) between two colors. It's calculated using a formula that compares the relative luminance of the lighter color to the darker color.

WCAG (Web Content Accessibility Guidelines) defines minimum contrast ratios:

  • AA Standard: 4.5:1 for normal text, 3:1 for large text
  • AAA Standard: 7:1 for normal text, 4.5:1 for large text

Higher contrast ratios mean better readability, especially for users with visual impairments.

How the Matrix Works

The contrast matrix displays a grid showing contrast ratios between text colors (rows) and surface colors (columns). Each cell shows:

Text vs Surfaces

Rows represent text color variants (text.default, text.muted, text.faint)

Columns represent surface color variants (surface.50, surface.100, surface.200, etc.)

Each cell shows the contrast ratio when that text color is placed on that surface

The matrix is color-coded to quickly identify which combinations pass or fail accessibility standards.

WCAG AA + AAA Levels

The matrix indicates compliance with both WCAG levels:

AA Compliance

Minimum contrast for most use cases. Required for most commercial websites and applications.

AAA Compliance

Higher contrast for enhanced accessibility. Recommended for content that needs to be accessible to users with severe visual impairments.

Which Pairs Pass / Fail

The matrix visually indicates:

  • Green cells: Pass both AA and AAA standards
  • Yellow cells: Pass AA but fail AAA
  • Red cells: Fail both AA and AAA standards

Hover over any cell to see the exact contrast ratio value.

How Designers Use the Matrix

The contrast matrix helps you:

  • Quickly identify safe text/surface combinations for your UI
  • Ensure all your semantic roles meet accessibility standards
  • Make informed decisions when choosing color combinations
  • Document accessibility compliance for stakeholders

Use the matrix during palette creation to adjust colors until all critical combinations pass WCAG standards.

WebShades is an OKLCH-based color palette generator for UI design and Tailwind CSS. Built by Drew Poling.