WCAG-Accessible Color Palette Generator

Color palettes that pass contrast accessibility checks

Generate random color palettes where the text-on-background pairing meets WCAG 2.1 AA or AAA contrast ratios. Outputs hex values plus the exact contrast ratio so your UI is readable and accessible. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What contrast ratio does WCAG require?

WCAG 2.1 AA requires 4.5:1 for normal text and 3:1 for large text (18pt or 14pt bold). AAA requires 7:1 for normal text and 4.5:1 for large text. This tool targets the normal-text thresholds.

Accessible palettes, generated and verified

This generator produces random color combinations and only shows you the ones that pass WCAG contrast requirements. Instead of guessing whether your text is readable, every palette comes with the measured contrast ratio so you know it meets AA (4.5:1) or AAA (7:1) before you ship it.

How it works

Contrast is computed with the official WCAG formula. First each color’s relative luminance is found by linearising its sRGB channels:

channel = c / 255
linear  = channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ^ 2.4
L = 0.2126*R + 0.7152*G + 0.0722*B
ratio = (Llight + 0.05) / (Ldark + 0.05)

The tool randomly samples a background and text color, measures the ratio, and rejects the pair if it falls below your chosen threshold. It repeats until both the text and the accent color clear the bar — so the displayed palette is always compliant.

Understanding AA vs AAA

The difference between the two levels matters for your use case:

LevelNormal textLarge textWho should target it
AA4.5:13:1Legal minimum in most jurisdictions; required by WCAG 2.1
AAA7:14.5:1Recommended for body copy; required for highest accessibility rating

Large text means 24px or 18.66px bold. The generator lets you target either level so you can pick the threshold that fits your product’s obligations or ambitions.

Worked example

Suppose you pick AAA mode and the generator returns:

  • Background: #f9f5ff (near-white lavender)
  • Text: #1a0a40 (deep indigo)
  • Contrast ratio: 12.8:1

Both text and accent colors cleared the 7:1 threshold. Paste those hex codes into your CSS directly — the compliance is already proven by the number shown.

What contrast doesn’t cover

A passing ratio means bright-versus-dark is adequate, but it does not guarantee hue distinguishability for color-blind users. Around 8% of men have some form of color vision deficiency. Best practice after picking a palette:

  1. Run the accent color through a color-blindness simulator.
  2. Verify interactive states (hover, focus, active) still meet contrast in their altered form.
  3. Test on real devices — screens vary in gamma and brightness.

Tips

  • Reserve AAA for body copy and dense reading surfaces; AA is usually sufficient for UI controls and icons.
  • The accent color in each palette is also verified against the background, so it’s safe for buttons and links on that background.
  • Generating several palettes and comparing the ratios helps you build an intuition for how far apart luminance values need to be to pass each level.