About the color lab

Check whether two colors have enough contrast to meet WCAG, find the closest tone that passes, and see how a palette looks with color-blindness.

The lab also finds the nearest classic Material Design color to any hex value, using CAM16 color distance, which matches how people perceive color better than RGB distance.

How to use it

  1. Enter a text color and a background color.
  2. Read the contrast ratio and the WCAG AA and AAA results, and use the suggested passing tone if it fails.
  3. Switch between the color-blindness views to check your colors still read clearly.

Questions

What contrast ratio does WCAG require?

Level AA needs 4.5:1 for normal text and 3:1 for large text (at least 18 pt, or 14 pt bold) and for UI components. Level AAA needs 7:1 for normal text and 4.5:1 for large text.

How is the closest passing color found?

The lab keeps your color's hue and chroma in the HCT color space and changes only its tone (lightness) until the contrast ratio passes, so the result looks like the same color, just lighter or darker.

Which kinds of color blindness can I preview?

Protanopia (no red cones), deuteranopia (no green cones), tritanopia (no blue cones) and achromatopsia (no color vision), simulated with the Machado, Oliveira and Fernandes (2009) model.