Accessible color palette generator
An accessible color palette is a set of UI colors where every text and background pair meets WCAG contrast: at least 4.5:1 for normal text and 3:1 for large text (AA), or 7:1 and 4.5:1 for AAA. Enter one brand HEX to generate a palette that is checked pair by pair.
Enter a brand HEX and get a compact UI palette with background, surface, text, primary and accent roles. Every text and background pair is tested against WCAG AA, and any failing pair is marked clearly.
Generate an accessible palette from one brand colour. The generator builds the five roles, calculates the real contrast ratio for each text and background pair, and labels every result as an AA pass or fail. Copy the CSS variables when the palette is ready, or open the palette contrast fixer to repair a pair that fails.
Using Tailwind v4? Copy the @theme block to register the same palette as --color-* tokens, so utilities like bg-background and text-primary work in your project. For a full palette built for Tailwind, try the Tailwind color generator.
Palette check
All five tested pairs meet WCAG AA at their stated threshold.
Click a swatch to copy its HEX. The text colour on each swatch is chosen for the best contrast.
WCAG AA pair results
Each ratio is calculated from the generated colours above. Normal text needs 4.5:1; UI components and large text need 3:1.
- Body text on backgroundNormal text#161b27 / #f9fafb16.47:1AA pass (4.5:1)
- Body text on surfaceNormal text on cards and panels#161b27 / #eff1f515.22:1AA pass (4.5:1)
- Button label on primaryNormal text on the main action colour#ffffff / #2563eb5.17:1AA pass (4.5:1)
- Accent text on backgroundLinks and highlights#8c6717 / #f9fafb4.94:1AA pass (4.5:1)
- Primary on backgroundUI component and large text#2563eb / #f9fafb4.95:1AA pass (3:1)
CSS variables
:root {
--color-background: #f9fafb;
--color-surface: #eff1f5;
--color-text: #161b27;
--color-primary: #2563eb;
--color-primary-text: #ffffff;
--color-accent: #8c6717;
}Tailwind v4 theme
@theme {
--color-background: #f9fafb;
--color-surface: #eff1f5;
--color-text: #161b27;
--color-primary: #2563eb;
--color-primary-text: #ffffff;
--color-accent: #8c6717;
}
How does the accessible palette generator work?
The generator reads the hue, saturation and lightness of your brand HEX. It keeps the brand colour as the primary role, then derives a near-white background and surface from the same hue, a dark text colour, and a complementary accent. The accent is darkened until it reaches 4.5:1 against the background, while the primary stays exactly as supplied so you can see whether the real brand colour passes.
Contrast is calculated with the WCAG relative luminance formula, not estimated by eye. A ratio runs from 1:1 for two identical colours to 21:1 for black on white. The pair results use the generated HEX values shown in the swatches above.
Which text and background pairs are tested?
Five pairs cover the roles a small interface needs: body text on the page background, body text on a surface, the button label on the primary colour, accent text on the background, and the primary colour as a UI element on the background. The first four use the 4.5:1 normal-text threshold. The last uses the 3:1 threshold for UI components and large text.
| Pair | WCAG AA minimum |
|---|---|
| Body text on background | 4.5:1 |
| Body text on surface | 4.5:1 |
| Button label on primary | 4.5:1 |
| Accent text on background | 4.5:1 |
| Primary on background | 3:1 |
What should you do when a pair fails WCAG AA?
Change the foreground or the background, not the threshold. Darken a light text colour, lighten a dark background, or pick a deeper shade of the same brand hue. The palette contrast fixer lets you adjust either colour and copy the passing values. To test a whole palette at once, use the palette accessibility checker. For real website colour schemes that already pass, browse accessible website color palettes.
A passing pair is not a whole-site accessibility audit. Hover, focus and disabled states, text over images, keyboard access, alternative text and the other WCAG criteria still need their own checks.
Accessible palette generator FAQ
What does the accessible palette generator do?
It takes one brand HEX colour and builds a compact UI palette with background, surface, text, primary and accent roles. It then calculates the WCAG contrast ratio for the text and background pairs in that palette and marks each pair as an AA pass or fail.
Which contrast ratio does WCAG AA require?
WCAG 2.2 level AA asks for at least 4.5:1 between normal text and its background. Large text and UI components need at least 3:1. The results table states the threshold used for each pair.
Why does a generated pair still fail WCAG AA?
The primary colour is kept exactly as your brand HEX, so a light brand colour can fail when it is used as a UI element on a light background. The failing row is marked clearly and links to the palette contrast fixer so you can adjust the pair.
Can I use the palette in CSS or Tailwind?
Yes. Copy the CSS variables block and paste it into your stylesheet, then reference the background, surface, text, primary and accent variables in your components. The HEX values are also copyable from each swatch.
More color tools
- Color contrast checker (WCAG)Test text and background colors against AA and AAA.
- WCAG color palette fixerAdjust text or background colors until they pass AA or AAA at your text size.
- Palette accessibility checkerCheck every pair in a palette against WCAG AA and AAA text contrast.
- Accessible color workflowOne hub for checking a pair or a palette, fixing failures, generating a palette and exporting CSS.
- Color blindness simulatorPreview colors, palettes and images as people with color vision deficiency see them.
- HEX to RGB converterConvert HEX, RGB and HSL colors, alpha included.
- HEX to RGBA converterAdd opacity to any hex color and copy rgba() or 8-digit hex.
- HEX to OKLCH converterConvert HEX, RGB or HSL to OKLCH and pick colours with L, C and H sliders.
- Hex opacity chartAlpha hex codes for every opacity from 0 to 100%.
- RGB to HEX converterTurn rgb() and rgba() values into HEX codes.
- RGBA to HEX converterTurn rgba() into an 8-digit HEX, or the solid HEX it shows on white or black.
- HEX to HSL converterConvert any HEX color to HSL or HSLA and copy CSS-ready hsl() values.
- RGB to HSL converterTurn rgb() and rgba() values into HSL or HSLA with a live preview.
- HSL to HEX converterTurn hsl() and hsla() values into HEX codes, alpha kept as 8-digit HEX.
- HSL to RGB converterTurn hsl() and hsla() values into rgb() and rgba() with a live preview.
- HEX to HSV converterRead any HEX color as hue, saturation and value (HSB) for Figma or Photoshop.
- HSV to HEX converterTurn HSV/HSB values into HEX and rgb() with a live preview.
- RGB to HSV converterConvert rgb() colours to hue, saturation and value (HSB).
- HEX to CMYK converterTurn a HEX code into CMYK print percentages with a live swatch.
- CMYK to HEX converterTurn print CMYK values into HEX and rgb() codes for the web.
- Color pickerDrag to pick any colour and copy its HEX, RGB, HSL, OKLCH or CMYK code.
- Color name finderFind the closest CSS colour name for any HEX, RGB or HSL code.
- RGB to CMYK converterTurn rgb() values into CMYK print percentages with a live swatch.
- CMYK to RGB converterTurn print CMYK values into rgb() and HEX codes for screens.
- OKLCH to HEX converterTurn oklch() and Tailwind v4 colours into HEX and rgb(), with a gamut check.
- Color code converters (HEX, RGB, HSL, CMYK, OKLCH)Every color converter in one place: HEX, RGB, RGBA, HSL, CMYK and OKLCH, with alpha kept and CSS-ready output.
- Color shades generatorGet 10% tints, shades and tones of any color and copy them as CSS.
- Color wheel & complementary color generatorFind complementary, analogous, triadic and tetradic colors for any HEX.
- Tailwind color palette generatorTurn one HEX into a 50–950 shade scale for Tailwind v3 or v4.
CSS generators
- CSS box-shadow generator
- CSS text-shadow generator
- CSS border radius generator
- CSS triangle generator
- CSS glassmorphism generator
- CSS neumorphism generator
- SVG wave divider generator
- CSS cubic-bezier easing generator
- CSS animation keyframes generator
- CSS loader generator
- CSS scrollbar generator
- CSS media query generator
- CSS button generator
- CSS toggle switch generator
- CSS grid generator
- CSS flexbox generator
- CSS filter generator
- CSS clip-path generator
- CSS gradient generator
- CSS background pattern generator
- CSS text gradient generator
- CSS generators (grid, flexbox, shadow, gradient, animation)