# Color Palette Generator

> The Color Palette Generator builds colour schemes from a base colour using colour-wheel harmonies, checks text contrast against WCAG 2 rules and exports the palette as CSS variables or a Tailwind config.

URL: https://atechcraft.com/color-palette-generator/
Category: Image Tools
Last updated: 2026-12-01
Author: Abdul Moid Khan, ATechCraft

Runs in your browser. Your data never leaves your device.

## How to use the Color Palette Generator

1. Choose a base colour with the picker or type a HEX code.
2. Pick a harmony: complementary, analogous, triadic, split, tetradic or monochrome.
3. Check text and background pairs in the contrast checker.
4. Copy the palette as CSS variables or Tailwind config.

## What is a color palette generator?

A color palette generator creates a set of colours that work well together, starting from one base colour. This one uses classic colour-wheel harmonies (complementary, analogous, triadic, split-complementary, tetradic and monochrome), includes a WCAG contrast checker to make sure text stays readable, and exports the palette as CSS variables or Tailwind CSS config.

It is useful for choosing brand colours, styling a website or app, or making a presentation look consistent.

## How are colour harmonies calculated?

The tool converts your base colour to HSL (hue, saturation, lightness). Hue is an angle on the colour wheel from 0 to 360 degrees. Harmonies are made by rotating the hue while keeping saturation and lightness the same:

| Harmony | Hue rotations | Feel |
| --- | --- | --- |
| Complementary | 0°, 180° | High contrast, bold |
| Analogous | −30°, 0°, +30° | Calm, natural, low contrast |
| Triadic | 0°, 120°, 240° | Lively but balanced |
| Split-complementary | 0°, 150°, 210° | Contrast with less tension than complementary |
| Tetradic | 0°, 90°, 180°, 270° | Rich, needs one dominant colour |
| Monochrome | Same hue, lightness 15% to 75% | Clean and safe; easy to make accessible |

For example, pure red (hue 0°) has the complementary colour cyan (hue 180°), which is `#00ffff`.

## How is the WCAG contrast ratio calculated?

The Web Content Accessibility Guidelines define contrast using **relative luminance**, a measure of how bright a colour looks to the human eye ([WCAG 2.2, Contrast Minimum](https://www.w3.org/TR/WCAG22/#contrast-minimum)).

1. Each red, green and blue value is divided by 255.
2. Each is converted to linear light: values up to 0.04045 are divided by 12.92; larger values use ((value + 0.055) ÷ 1.055) raised to the power 2.4.
3. Luminance L = 0.2126 × R + 0.7152 × G + 0.0722 × B. Green counts most because our eyes are most sensitive to it.
4. Contrast ratio = (L of the lighter colour + 0.05) ÷ (L of the darker colour + 0.05).

The result runs from 1:1 (no contrast) to 21:1 (black on white). This tool's formula is covered by automated tests that check known pairs, such as black on white giving exactly 21:1.

## Worked example

Grey `#767676` text on a white background:

- White has luminance 1.0.
- `#767676` has 118 in each channel. 118 ÷ 255 = 0.4627, which converts to about 0.181 in linear light, so L ≈ 0.181.
- Ratio = (1.0 + 0.05) ÷ (0.181 + 0.05) ≈ **4.54:1**.

That passes level AA for normal text (4.5:1 needed) but fails level AAA (7:1 needed). One step lighter, `#777777`, drops just below 4.5:1 and fails AA.

| Level | Normal text | Large text (24 px, or 18.66 px bold) |
| --- | --- | --- |
| AA | 4.5:1 | 3:1 |
| AAA | 7:1 | 4.5:1 |

## Tips for a usable palette

1. **Pick one main colour and use the others as accents.** The 60-30-10 rule (60% neutral, 30% main, 10% accent) is a good starting point.
2. **Check every text and background pair** you will actually use, including buttons and links.
3. **Monochrome palettes** are the easiest way to get accessible shades of a brand colour for hover states and borders.
4. **Start from a real image.** Pull a colour from a photo or logo with the [Color Picker from Image](https://atechcraft.com/color-picker-from-image/).
5. Turn your palette into a background with the [CSS Gradient Generator](https://atechcraft.com/css-gradient-generator/) and add depth with the [Box Shadow Generator](https://atechcraft.com/box-shadow-generator/).
6. Use your main colour as the icon background in the [Favicon Generator](https://atechcraft.com/favicon-generator/).

## Limitations

- **Colour theory is a guide, not a rule.** A harmony can still look wrong for your brand. Trust your eye and your audience.
- **WCAG 2 contrast** is the current legal and industry standard, but it is known to rate some dark-mode pairs oddly. The proposed APCA method in future WCAG drafts may change the numbers. This tool uses WCAG 2.
- **Very dark or very light base colours** produce harmonies that look similar, because hue matters little near black and white.
- **Colour blindness** is not simulated here. Do not rely on colour alone to show meaning.

## Key terms

- **Hue:** the colour family, measured in degrees around the colour wheel.
- **Relative luminance:** perceived brightness, from 0 (black) to 1 (white).
- **Contrast ratio:** how different two colours are in brightness.

## Frequently asked questions

### What contrast ratio do I need?

WCAG 2 level AA asks for at least 4.5:1 for normal text and 3:1 for large text (about 24 px, or 18.66 px bold). Level AAA asks for 7:1 and 4.5:1.

### How is the contrast ratio calculated?

Each colour’s relative luminance is calculated from its red, green and blue values, then the ratio is (lighter + 0.05) ÷ (darker + 0.05), exactly as defined in WCAG 2.

### What is a triadic palette?

Three colours spaced evenly, 120 degrees apart, on the colour wheel. It gives strong contrast while staying balanced.

### Can I use the palette in Tailwind CSS?

Yes. Copy the Tailwind export and paste it into your theme colours, or use the CSS variables inside Tailwind 4’s @theme block.
