Skip to content

Color Palette Generator

Choose a base color and the tool builds the palette with the harmony you pick: complementary, analogous, triadic, split-complementary, tetradic or shades and tints. It can also draw a random palette where you lock the colors you like. Every swatch shows whether white or black text reads well on it, and the palette copies out as CSS variables or JSON.

Works anywhere in the world, wherever you are.

Palette type

Palette

Complementary

2 colors · The base color and its opposite on the color wheel (180°): the strongest hue contrast.

  • Base

    #3366CC

    White 5.36:1 · AA

    Black 3.91:1 · AA large

  • +180°

    #CC9933

    White 2.56:1 · fails

    Black 8.17:1 · AAA

Export
:root {
  --color-1: #3366CC;
  --color-2: #CC9933;
}

Harmonies turn the base color's hue around the HSL wheel and keep its saturation and lightness. Each swatch shows the contrast of white and of black text per WCAG 2.2: AA asks for 4.5:1 for normal text and 3:1 for large text.

Everything is generated in your browser. The base color and options are remembered on your device and go in the Share link; random palettes are not saved.

About this calculator

How to use it

Enter the base color in HEX, RGB, HSL, HSV or CMYK, or choose it with the picker, then the palette type. Each swatch carries its HEX code with a copy button, its place in the harmony (for example, +120°) and the contrast of white and black text on it.

In “Random” the tool draws 5 colors. Tap the padlock on the ones you want to keep and press “Generate another palette”: only the unlocked ones change.

Below, under “Export”, the palette comes as CSS variables (:root { --color-1: … }) or as JSON with each color's HEX and rgb(), to copy or download.

How each palette is built

Harmonies use the HSL color wheel: the base color's hue is turned and its saturation and lightness are kept. Complementary adds 180°; analogous, 30° to each side; triadic, 120° and 240°; split-complementary, 150° and 210°; and tetradic (square), 90°, 180° and 270°.

Shades and tints keep the hue: they mix the color with black or white in 20% steps. A 20% tint is each channel + (255 − channel) × 0.2; a 20% shade is each channel × 0.8.

In random mode, every color comes from the browser's cryptographic generator (crypto.getRandomValues): any hue from 0° to 359°, saturation from 45% to 90% and lightness from 30% to 75%, so none come out dull grey or near-black.

The contrast on each swatch uses the WCAG 2.2 formula. Next to the figure you see AAA (7:1 or more), AA (4.5:1), “AA large” (3:1, good for large text only) or “fails”. The swatch's HEX code is written in whichever text color reads better.

Example

With the blue #3366CC as the base, the complementary color is #CC9933, a gold. Triadic gives #3366CC, #CC3366 and #66CC33.

In shades and tints, the 20% tint is #5C85D6: red 51 becomes 51 + (255 − 51) × 0.2 = 91.8, which rounds to 92 (5C in HEX). The full scale runs from #0A1429 to #D6E0F5.

On #3366CC, white text gives 5.36:1 and passes AA; black text gives 3.91:1 and only works for large text. That is why that swatch's code is written in white.

Tips for using the palette

A handy design rule is to split colors 60-30-10: one dominant, one secondary and one accent. Four-color palettes such as tetradic look best with one color in charge and the rest in details.

For long text, stick to combinations that pass AA. If you like a palette color but it falls short on contrast, use one of its shades or tints for the text or the background.

Important limitations

  • Harmonies are geometric rules on the color wheel, not a promise the palette will look good in your project: try it with your real content.
  • It works in 8-bit sRGB on the HSL wheel. Other color models (such as the painter's RYB wheel) give different complements.
  • The contrast shown is for white and black text on each color. For two palette colors against each other, use the contrast checker in the Color Converter.
  • Random palettes are not saved or put in the Share link: copy or download them if you want to keep them.

Frequently asked questions

The one across the color wheel, 180° away in hue. On the HSL wheel, the complement of #3366CC (a blue) is #CC9933, a gold. Choose “Complementary” and enter your color.

Analogous uses neighboring colors (30° to each side of the base), which blend gently. Triadic uses three colors spread 120° apart, more varied and with more contrast.

A shade is the color mixed with black; a tint, mixed with white. They keep the hue and work for backgrounds, borders and button states without leaving the palette.

Tap the padlock under the swatch. When you press “Generate another palette”, locked colors stay and only the rest change. Each palette has 5 colors.

Copy or download the “CSS variables” export and paste it into your stylesheet; then use var(--color-1), var(--color-2) and so on in your rules. The JSON is handy for design tools or your own code.

Not on any server: everything is generated in your browser. The base color and options are remembered on your device and go in the Share link; random palettes are not saved.

This calculation runs in your browser and is never sent to a server. Your last values may be saved on your device only, for convenience. Results are estimates and are not financial, tax, accounting or legal advice.