Skip to main content
Back to Blog

Accessible Color Palettes: A Practical Design Guide

Build palettes from a base color and check contrast so your UI looks good and meets accessibility guidelines.

Kashyap Thakar
8 min
DesignAccessibilityColor
Accessible Color Palettes: A Practical Design Guide

A palette can look beautiful and still fail the people who have to read it. Contrast is the part you can measure, so this guide starts there and then covers harmonies, color vision deficiency, and how to test.

Understanding Contrast Ratio

The Web Content Accessibility Guidelines (WCAG) define specific contrast ratios for text and background:

  • AA Level: Minimum 4.5:1 for normal text.
  • AAA Level: Minimum 7:1 for normal text.

Low contrast (like light gray text on a white background) is tiring to read and can be unreadable for people with low vision.

Color Harmonies Explained

To create a pleasing palette, designers use the color wheel. Here are the most common harmonies, visually explained:

1. Monochromatic

Uses a single color with variations in lightness and saturation. This creates a cohesive, sophisticated look with subtle depth.
Purpose: Minimalist designs and restrained branding, where you want focus without distraction.

Darkest
#1e40af

Dark
#2563eb

Base
#3b82f6

Light
#60a5fa

Lightest
#93c5fd

2. Complementary

Colors that are directly opposite each other on the color wheel (180° apart). This gives the strongest hue contrast on the wheel and tends to look vibrant. Note that hue contrast is not luminance contrast: the blue and orange below still need separate contrast checks for text.
Purpose: Call-to-action buttons or highlighting key information.

Blue
#3b82f6

Orange
#f97316

3. Analogous

Colors that are next to each other on the color wheel (typically 30° apart). They usually sit well together and feel calm.
Purpose: Backgrounds, gradients, or cohesive branding.

Cyan
#06b6d4

Blue
#3b82f6

Violet
#8b5cf6

4. Triadic

Three colors that are evenly spaced around the color wheel (120° apart). This tends to be quite vibrant, even if you use pale or unsaturated versions of your hues.
Purpose: Playful or complex interfaces where you need distinct categories.

Blue
#3b82f6

Rose
#f43f5e

Lime
#84cc16

5. Tetradic

Four colors arranged as two complementary pairs. When the four hues are evenly spaced, 90° apart, the scheme is called a square. In a rectangle the pairs are not evenly spaced. Either way it is the most varied scheme and the hardest to balance, so let one hue dominate.
Purpose: Dashboards, data visualizations, or content-heavy designs that need several distinct colors. Remember that categories must also differ by more than hue (see below).

Blue
#3b82f6

Amber
#f59e0b

Red
#ef4444

Emerald
#10b981

The swatches above are Tailwind palette colors chosen to illustrate each scheme. Their hues are close to, not exactly at, the stated angles.

Color Blindness Considerations

The US National Eye Institute reports that about 1 in 12 men have a color vision deficiency, and that it is much less common in women. Commonly cited figures for people of Northern European descent are roughly 8% of men and 0.5% of women, and rates differ between populations. The most common kinds are:

  • Red-green deficiencies: by far the most common group, making reds, greens, and browns hard to tell apart. Deuteranomaly (reduced green sensitivity) is the most common form. Deuteranopia and protanopia are the more severe variants, where the green or red response is absent.
  • Blue-yellow deficiencies (tritanomaly, tritanopia): much rarer, affecting the distinction between blues and greens or yellows and pinks.

Best Practice: Never rely solely on color to convey information. Use icons, patterns, or text labels in addition to color.

Calculating Contrast Ratios

The contrast ratio is calculated using the relative luminance of the foreground and background colors:

Contrast Ratio = (L1 + 0.05) / (L2 + 0.05)
Where L1 is the lighter color and L2 is the darker color

Modern tools calculate this automatically, but understanding the formula helps you make informed design decisions.

A worked computation

Relative luminance converts each 8-bit sRGB channel to a linear value, then weights green most and blue least, reflecting how the eye responds. WCAG 2.x defines it as L = 0.2126 R + 0.7152 G + 0.0722 B after linearizing each channel. (WCAG 2.2 uses 0.04045 as the linearization threshold, where older versions printed 0.03928. The difference does not change any 8-bit result.) Here is the whole algorithm in a few lines of JavaScript:

function channel(v) {
  const c = v / 255;
  return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
}
function luminance(hex) {
  const n = parseInt(hex.slice(1), 16);
  const [r, g, b] = [n >> 16, (n >> 8) & 255, n & 255];
  return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
}
function contrast(a, b) {
  const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
  return (hi + 0.05) / (lo + 0.05);
}

Running it on the blues used earlier in this article, against a white background, gives:

Foreground on whiteRatioNormal text
#3b82f63.68:1Fails AA (passes 3:1 for large text and UI)
#2563eb5.17:1Passes AA
#1e40af8.72:1Passes AAA
#f973162.80:1Fails AA and the 3:1 threshold

The takeaway: the "Base" blue in the monochromatic swatches above is a fine accent for large headings, icons and borders, but not for body text on white. For text, step down to the "Dark" or "Darkest" shade. The classic edge case is gray: #767676 on white is 4.54:1 and passes AA, while the nearly identical #777777 is 4.48:1 and fails. Ratios are not rounded up for compliance, so a 4.48 does not count as 4.5.

What WCAG Actually Requires

Contrast is spread across several success criteria in WCAG 2.x, and they are often conflated:

  • 1.4.3 Contrast (Minimum), Level AA: 4.5:1 for normal text, 3:1 for large text.
  • 1.4.6 Contrast (Enhanced), Level AAA: 7:1 for normal text, 4.5:1 for large text.
  • 1.4.11 Non-text Contrast, Level AA: 3:1 for user interface components (such as input borders and the visible state of a focused control) and for graphical objects needed to understand content.
  • 1.4.1 Use of Color, Level A: color must not be the only way to convey information.

"Large text" means at least 18 point (24 CSS pixels), or at least 14 point (about 18.5 CSS pixels) when bold. Incidental text is exempt from 1.4.3: disabled controls, purely decorative text, and logotypes do not have to meet the ratio. Placeholder text and link text inside body copy are not exempt, which catches many designs out.

Not Relying on Color Alone

Meeting 1.4.1 means pairing color with a second cue. Some patterns that work in practice:

  • Form errors: a red border plus an error icon and a text message that names the problem.
  • Links in paragraphs: keep the underline, or ensure the link color differs from surrounding text by at least 3:1 and add another cue on hover and focus.
  • Charts: vary line style, marker shape or pattern fill, and label series directly rather than relying on a legend of similar hues.
  • Status badges: "Failed" and "Passed" as words, not just red and green dots.

A quick test: convert the page to grayscale (most browsers' DevTools can emulate color vision deficiencies and the CSS grayscale filter works too). If any meaning disappears, the design leans on color alone.

Designing Dark-Mode Palettes

Dark mode is not an inverted light theme. Contrast has to be re-verified because the same hue behaves differently on a dark surface. For example, against a dark slate background (#0f172a), the light blue #93c5fd measures 9.90:1, and the base blue #3b82f6, which failed on white, measures 4.85:1 and passes AA for text. Colors move in the opposite direction from what intuition suggests.

  • Define colors as semantic tokens (--text, --surface, --accent) and give each theme its own tested values rather than deriving one from the other automatically.
  • Soften very saturated accents on dark backgrounds. Vivid colors can appear to vibrate against near-black.
  • Prefer an off-white text color over pure white on a pure black surface if glare is a concern, but still verify the ratio.
  • Respect user preferences with the prefers-color-scheme media query, and consider prefers-contrast for users who ask for higher contrast.

How to Test Your Palette

  • Browser DevTools: the color picker in Chrome DevTools shows the contrast ratio of a text color against its background and whether it meets AA or AAA.
  • Automated audits: tools such as Lighthouse and axe flag many text contrast failures. They cannot judge text over images or gradients reliably, so check those by hand.
  • Every state: default, hover, focus, active, visited and disabled. Test text on each background it can appear over, including cards, banners and toasts.
  • Color vision emulation: DevTools can simulate protanopia, deuteranopia, tritanopia and achromatopsia.
  • A scripted check: run the contrast() function above over every foreground and background token pair in a unit test so a palette change cannot silently regress.

The WCAG 2.x formula is a simplified model of human vision, and passing it does not guarantee comfortable reading. Alternative models such as APCA have been proposed for future guidance, but WCAG 2.x ratios are what conformance claims reference, and many accessibility laws and policies point to WCAG 2.x.

Building an Accessible Palette

  1. Start from your brand or primary color and generate lighter and darker shades of it.
  2. Pair every text and background token you plan to use and check the ratio for each pair. Level AA is the usual conformance target. AAA is worth aiming for on body text where you can, but WCAG does not recommend requiring it for whole sites because not all content can meet it.
  3. Add semantic colors for success, error, warning, and info, check each against its background, and give each a second cue (icon or label) so color is not the only signal.
  4. Check hover, focus, disabled, and dark-mode variants separately, since each has its own foreground and background.

Generating a Starting Point

Our Color Palette Generator takes a base color and produces a monochromatic, analogous, complementary, triadic, or tetradic palette (the tetradic option spaces four hues 90° apart), with a shuffle button and one-click copy of each hex value or the whole palette. It does not check contrast, so run the resulting pairs through the formula above or your browser's DevTools. Generation happens in your browser.

See 5 Essential Browser Tools Every Frontend Developer Needs for related tooling, and Privacy First: Why Client-Side Developer Tools Matter for why client-side generation matters.

Frequently Asked Questions

What contrast ratio do I need for WCAG AA?

4.5:1 for normal text and 3:1 for large text (18pt or 14pt bold and above), plus 3:1 for UI components and meaningful graphics. AAA raises text requirements to 7:1 and 4.5:1 respectively.

Does the logo or disabled button need to meet contrast requirements?

No. WCAG 1.4.3 exempts logotypes, purely decorative text and inactive (disabled) controls. Even so, making disabled states legible enough to recognize is good practice.

Is 4.5:1 rounded, so 4.48 passes?

No. The ratio must be at least 4.5. A pair measuring 4.48:1, such as #777777 on white, fails, while #767676 at 4.54:1 passes.

How do I make a palette color-blind friendly?

Vary lightness, not only hue, so colors remain distinguishable in grayscale, and add a second cue such as an icon, label or pattern. Then check the result with the color vision emulation in browser DevTools.

Do I need to check contrast again for dark mode?

Yes. Each theme needs its own verified token values, because a color that fails on white can pass on a dark surface and the reverse.

Written by

Spotted a mistake? Let me know