How the color palette generator builds a color scheme
Every palette starts from one base color. The generator turns that color around a color wheel by fixed angles, the classic rules of color harmony, and adds lighter and darker versions where a harmony has fewer than five colors. What makes the result look balanced is the color space it works in.
The simplest way to build harmonies is to turn the hue in HSL, the hue, saturation and lightness model of CSS. But HSL lightness is plain math, not perception: hsl(60, 100%, 50%) yellow and hsl(240, 100%, 50%) blue share 50% lightness, yet the yellow looks far brighter, and OKLCH rates them at 97% and 45% lightness. Harmonies built in HSL mix colors that jump out with colors that sink.
This tool works in OKLCH, the polar form of Oklab, a color space Björn Ottosson published in 2020 to predict how light, colorful and which hue a color looks. OKLCH has three values: lightness L from 0 to 100%, chroma C for how colorful it is, and hue H in degrees. Two colors with the same L look about equally light, whatever their hue. So the harmony colors keep the lightness and chroma of your base and only the hue changes, which gives every color in the palette the same visual weight.
One limit remains: HEX and RGB can only store colors inside sRGB, and some hues cannot be as colorful as others at a given lightness. When a harmony color falls outside sRGB, the generator keeps its lightness and hue and lowers only the chroma until it fits. Every color you copy is a real, displayable color.
Color harmonies at a glance
The angles are hue steps on the OKLCH wheel, measured from the base color. The example palettes below all start from #2A9D8F and come from the same code as the tool.
| Harmony | Hue angles | Example palette | Good for |
|---|---|---|---|
| Complementary | 0°, 180° | Strong contrast: one main color and one accent for calls to action | |
| Analogous | -60°, -30°, 0°, +30°, +60° | Calm, natural looks, backgrounds and illustrations | |
| Triadic | 0°, 120°, 240° | Lively brands and playful interfaces | |
| Split complementary | 0°, 150°, 210° | Contrast like complementary, with less tension | |
| Tetradic | 0°, 60°, 180°, 240° | Rich palettes and charts with four distinct hues | |
| Monochromatic | 0° only | Quiet, elegant interfaces built from one hue |
- Complementary pairs colors from opposite sides of the wheel. It gives the strongest contrast, so let one color lead and use the other sparingly, for example on a single button.
- Analogous uses neighbors 30 degrees apart. The colors blend easily, which suits calm brands, photography sites and illustrations.
- Triadic spaces three hues evenly, 120 degrees apart. It stays colorful and balanced, and works best when one hue dominates.
- Split complementary swaps the single opposite for the two hues next to it. You keep strong contrast with less tension.
- Tetradic, also called rectangle, combines two complementary pairs. Four distinct hues are great for charts and rich palettes but need a clear leader.
- Monochromatic keeps one hue and changes only the lightness. It is the safest choice and looks calm and elegant.
Shades and tints from 50 to 950
A design system needs more than one lightness of each color: a light tint for backgrounds, a mid tone for buttons and dark shades for text. Tailwind CSS names these steps from 50 to 950: every color in its default palette has 11 steps, with 50 the lightest and 950 the darkest.
The Shades and tints mode builds such a scale. Your color sits at the step closest to its lightness, the lighter steps climb in equal OKLCH lightness steps to an almost white 50, and the darker steps go down to 950. Chroma fades toward white, so the tints stay soft and usable as backgrounds. Here is the scale for #2563EB, with its contrast against white and black text:
| Step | HEX | OKLCH L | With white text | With black text |
|---|---|---|---|---|
| 50 | #F3F7FF | 97.5% | 1.07:1 Fail | 19.55:1 AAA |
| 100 | #CFE0FE | 90.3% | 1.33:1 Fail | 15.74:1 AAA |
| 200 | #ADC8FD | 83.1% | 1.68:1 Fail | 12.45:1 AAA |
| 300 | #8BB1FA | 76.1% | 2.15:1 Fail | 9.76:1 AAA |
| 400 | #6998F6 | 68.8% | 2.82:1 Fail | 7.42:1 AAA |
| 500 | #487FF1 | 61.8% | 3.76:1 AA large | 5.58:1 AA |
| 600 (base) | #2563EB | 54.6% | 5.16:1 AA | 4.06:1 AA large |
| 700 | #1A4FC4 | 47.1% | 7.09:1 AAA | 2.95:1 Fail |
| 800 | #103C9F | 39.8% | 9.68:1 AAA | 2.16:1 Fail |
| 900 | #072A7B | 32.4% | 12.91:1 AAA | 1.62:1 Fail |
| 950 | #021A57 | 25.0% | 16.30:1 AAA | 1.28:1 Fail |
Check contrast before you ship
A palette that looks great can still be hard to read. WCAG 2, the Web Content Accessibility Guidelines, ask for a contrast ratio of at least 4.5:1 for normal text at level AA and 3:1 for large text, which means at least 18 point or 14 point bold. Level AAA raises that to 7:1 and 4.5:1.
The table under the palette checks every color with white and black text. AA large means the pair passes only for large text. A practical rule of thumb: use the colors that pass with white text for buttons and dark surfaces, and the ones that pass with black text for light backgrounds and badges. For any other pair, such as text in one palette color on another, use the Color Contrast Checker.
Exporting your palette
- CSS variables go into :root, ready for var(--brand-1) anywhere in your stylesheet.
- Tailwind 4 gives an @theme block. Tailwind 4 reads custom colors from the --color- namespace, so --color-brand-500 becomes classes like bg-brand-500 and text-brand-500.
- Tailwind 3 gives a colors object for theme.extend in tailwind.config.js, which adds your palette next to the default colors.
- JSON lists each color with its name, role, HEX, RGB, HSL and OKLCH value, handy for design tokens and scripts.
- HEX list puts one code per line, handy for design apps, documents and brand guides.
- PNG downloads a swatch image with the HEX codes for mood boards and presentations.
The values switch lets you write the CSS and Tailwind code as HEX, RGB, HSL or OKLCH. The oklch() function has worked across all major browsers since May 2023, so OKLCH values are a safe choice for modern sites. To convert a single color into more formats, use the Color Converter.
Tips for a palette that works
- Pick one leader. Let the base color carry the brand and use the other colors as accents for buttons, highlights and charts.
- Add neutrals. Your palette also needs colors for text, surfaces and borders. Run your base through Shades and tints, or pick a gray with a hint of your hue as a new base and use its light and dark steps.
- Vary the lightness. If a palette feels flat, press Space a few times. Generate varies the lightness and chroma of the harmony colors while keeping their hues.
- Test in context. Try the palette on real buttons, cards and backgrounds in a quick mockup, or blend two colors in a CSS gradient, before you commit.
- Save the link. Copy link stores the base, the harmony, the variations and your locked colors in the URL, so you can come back to the exact palette or share it with your team.
How to use the color palette generator
- 1Enter your base color as HEX, RGB, HSL or OKLCH, or choose it with the color picker.
- 2Choose a harmony: complementary, analogous, triadic, split complementary, tetradic, monochromatic, or shades and tints for a 50 to 950 scale.
- 3Lock the colors you like and press Space or Generate to vary the rest. Undo goes back one step.
- 4Check the text contrast table, then export the palette as CSS variables, Tailwind, JSON or a HEX list, download a PNG or copy a link.
Frequently asked questions
Why does the complement of my blue look olive or mustard?
The generator keeps every harmony color at the lightness of your base color in OKLCH, so the palette has an even visual weight. Yellow is a naturally light hue, and a yellow as dark as a medium blue looks olive or mustard. Press Space or Generate for versions with different lightness, or start from a lighter base color if you want a bright yellow partner.
Why does this complementary color differ from other color wheels?
Color wheels place the hues differently, so they give different opposites for the same color. Turn #2563EB by 180 degrees in HSL and you get the bright amber #EBAD25. Turn it in OKLCH at the same lightness and you get the darker #906900. OKLCH is built around how people see color, which keeps the palette balanced, but no wheel is the one true answer. Trust your eye.
How do I keep a color and change the rest?
Press the lock icon on any swatch, then press Space or the Generate button. Locked colors stay exactly as they are and the others get new variations. With nothing locked, Generate also picks a new base color. Once you lock a color, the base keeps its hue, so the new colors still fit the harmony of the ones you locked. Undo brings back the previous palette.
How are the 50 to 950 shades and tints made?
Your color goes to the step whose lightness is closest to it, so a medium blue may become 500 or 600. The steps above it get lighter in equal OKLCH lightness steps up to an almost white 50, the steps below get darker down to 950. Chroma fades toward white so the light tints stay soft instead of glowing.
Can I use the palette in Tailwind CSS?
Yes. Choose Tailwind 4 to get an @theme block with --color- variables, which creates classes like bg-brand-500. Choose Tailwind 3 for a colors object you paste into theme.extend in tailwind.config.js. Set your own token name first, for example primary or accent.
Why are some colors less saturated than my base?
HEX and RGB can only store colors inside the sRGB range. A harmony color with the same lightness and chroma as your base can fall outside it, especially for very vivid bases. The generator then keeps the lightness and hue and lowers only the chroma until the color fits, so every value you copy is a real, displayable color.
Are the colors accessible?
The table under the palette shows the contrast of every color with white and with black text. WCAG 2 asks for at least 4.5:1 for normal text and 3:1 for large text at level AA. Use the colors that pass for text and buttons, and keep the others for backgrounds, borders and illustrations.