How to use the color palette generator
- Press New palette (or the space bar on a keyboard) to get five colors that follow a color harmony. Each press draws a new random palette.
- Lock the colors you like with the padlock under each swatch. Locked colors stay where they are while the others change; in random mode the first locked color also becomes the anchor the new colors are built around, so they keep matching it.
- Start from your own color: switch Start from to My base color and choose it — a brand color, for example. Every palette then contains that exact color.
- Pick a harmony (analogous, monochromatic, complementary, split-complementary, triadic, tetradic, or shades and tints), or leave it on Any to get a different one each time.
- Fine-tune a color with the pencil, which opens your device’s color chooser; the edited color is locked automatically.
- Take colors from a photo: press Colors from an image, drop a file on the tool or paste a screenshot. The five main colors of the image are found and locked.
- Copy and export: tap any code to copy it, switch the codes between HEX, RGB, HSL and OKLCH, copy the whole palette as CSS variables or JSON, or download a PNG with the five swatches. Copy link gives an address that opens exactly this palette.
Everything runs in your browser. An image you load is read on your device, shrunk to at most 100 pixels on its longest side and analyzed there; it is never uploaded.
Why the palettes are generated in OKLCH
Most color wheels — HSL in CSS, HSV/HSB in design apps — are simple rearrangements of the red, green and blue channels, not models of how people see. At the same HSL lightness of 50%, pure yellow looks far brighter than pure blue, so a palette that rotates the hue in HSL jumps between glaring and murky colors. This generator works in OKLCH, the polar form of OKLab, a perceptual color space published by Björn Ottosson in 2020 and adopted in the CSS Color Module Level 4 as the oklch() function. Its three numbers are L (perceived lightness, 0–100%), C (chroma, how colorful: 0 is gray, sRGB colors reach about 0.32) and H (hue angle in degrees). Equal steps in L look like equal steps in brightness, whatever the hue.
Converting a color takes three steps: undo the sRGB gamma curve to get linear light, multiply by a fixed matrix to get cone-like responses and take their cube roots, then multiply by a second matrix to get L, a and b. Chroma is √(a² + b²) and hue is atan2(b, a). Reference values from this tool, which match the published ones:
| Color | HEX | OKLCH |
|---|---|---|
| Red | #ff0000 | oklch(62.8% 0.258 29.2) |
| Lime | #00ff00 | oklch(86.6% 0.295 142.5) |
| Blue | #0000ff | oklch(45.2% 0.313 264.1) |
| White | #ffffff | oklch(100% 0 0) |
| Navy #1f4e79 | #1f4e79 | oklch(41.4% 0.088 249.1) |
Not every OKLCH color exists on a screen. When a planned color falls outside the sRGB gamut, the generator keeps its lightness and hue and lowers its chroma until it fits — the same idea as the gamut mapping in CSS Color 4 — so the palette never shifts hue just because a color was clipped.
How a palette is built
Every palette starts from an anchor: your base color, the first locked color, or a random color with a lightness between 45% and 80% and a moderate chroma. The four other colors get the hues of the chosen harmony and lightness levels spread between 30% and 90% (the level closest to the anchor is skipped, so every color differs from it in lightness). Chroma varies by up to 30% around the anchor’s and tapers off toward very light and very dark colors, which look garish when fully saturated. A random number drawn when you press New palette drives every choice, and the same number always gives the same palette — that is how a copied link reproduces your colors exactly.
| Harmony | Hues relative to the anchor | Character |
|---|---|---|
| Analogous | −2 to +2 steps of 18–32° | Calm, natural, cohesive |
| Monochromatic | Same hue, five lightness levels | Safe for interfaces and charts |
| Complementary | 0° and 180° | Strong contrast; use the opposite hue as an accent |
| Split-complementary | 0°, 150° and 210° | Contrast that is easier to balance |
| Triadic | 0°, 120° and 240° | Lively; let one hue dominate |
| Tetradic (square) | 0°, 90°, 180° and 270° | Rich; keep most colors muted |
| Shades and tints | Same hue, mixed with white and black in OKLab | One color for backgrounds, borders and text |
Because the hue angles are measured on the OKLCH wheel, the complement of a color can differ from what an HSL or painter’s (red-yellow-blue) wheel shows: the OKLCH complement of navy #1f4e79 (hue 249°) is a warm olive-orange hue near 69°.
Worked example: a triadic palette from #1f4e79
With the base color #1f4e79 (OKLCH lightness 41.4%, chroma 0.088, hue 249.1°) and the triadic harmony, the page’s starting seed produces the colors below. Hues sit near 249°, 9° and 129°, each 120° apart, and the lightness levels range from 28.7% to 92.9%:
| # | HEX | OKLCH | White text | Black text |
|---|---|---|---|---|
| 1 | #1f4e79 | oklch(41.4% 0.088 249.1) | 8.66:1 | 2.42:1 |
| 2 | #461a23 | oklch(28.7% 0.068 9.7) | 14.66:1 | 1.43:1 |
| 3 | #758e58 | oklch(61.3% 0.082 128.8) | 3.64:1 | 5.76:1 |
| 4 | #ffdee2 | oklch(92.9% 0.037 9.5) | 1.25:1 | 16.79:1 |
| 5 | #a2b68d | oklch(75% 0.061 129) | 2.18:1 | 9.61:1 |
The contrast columns tell you which text works on each color. Dark burgundy carries white text at 14.66:1, the pale pink carries black text at 16.79:1, and the middle green reaches only 3.64:1 with white — fine for large headings, too low for body text.
Contrast ratios and accessibility
Each swatch shows the better of white or black text on it, with its ratio and grade, and the contrast table under the palette lists both. The numbers follow the Web Content Accessibility Guidelines (WCAG) 2.2 from the W3C: relative luminance is 0.2126 R + 0.7152 G + 0.0722 B of the linearized channels, and the ratio is (lighter + 0.05) / (darker + 0.05), from 1:1 to 21:1. Normal text needs 4.5:1 for level AA and 7:1 for AAA; large text (24 px, or 18.7 px bold) needs 3:1 for AA. Ratios are cut, not rounded, at two decimals, so a color never shows a pass it doesn’t reach.
Tips for using a palette
- Give the colors roles. A common split is 60% background or dominant color, 30% secondary and 10% accent; the darkest color often works as text.
- Check text before you commit. Use the contrast table, or paste any pair into the color picker to see its codes and contrast.
- Don’t rely on hue alone. About 1 in 12 men has a red-green color vision deficiency; vary lightness too, and try the color blindness test to understand what people may miss.
- Use the CSS export as a starting point for design tokens: rename
--color-1and friends to roles such as--brandor--surface.
Frequently asked questions
How do I get a palette from my brand color?
Set Start from to My base color, choose your color and pick a harmony. Every palette then contains your exact color, and the other four are built around it. Press New palette until you like the result.
How do I keep a color I like?
Tap the padlock under it. Locked colors stay put when you press New palette or the space bar, and the first locked color anchors the next palettes, so the new colors still match. Tap the padlock again to unlock it.
Can I make a palette from a photo?
Yes. Press Colors from an image, drop the file on the tool or paste a screenshot. The image is shrunk to at most 100 pixels on your device, its pixels are grouped by median cut and refined with k-means, and the five largest groups become the palette, most common first. Nothing is uploaded.
How do I share or save a palette?
Press Copy link: the address contains the colors, the locks and the random seed, so it opens the same palette anywhere. The page also remembers your last palette on this device. To keep a picture, use Download PNG.
Why use OKLCH instead of HSL?
OKLCH is perceptual: the same lightness number looks equally bright in every hue, so palettes keep an even, deliberate range of light and dark colors. In HSL, yellow and blue at 50% lightness look very different. The oklch() codes also work directly in current browsers’ CSS.
What do AAA, AA and Low mean on the swatches?
They grade the better of white or black text on that color by WCAG 2.2: AAA is at least 7:1, AA at least 4.5:1 (enough for body text), AA large at least 3:1 (headings only) and Low below 3:1.
Last updated: October 15, 2026