Color Palette Generator

Color Palette Generator

Press New palette or the space bar for five colors that work together. Lock the ones you like and keep generating, start from your own base color, or take the colors from a photo. Every color comes with HEX, RGB, HSL and OKLCH codes and a WCAG contrast check; images stay on your device.

Start from
HarmonySplit-complementary (picked at random)

One hue plus the two hues 30° either side of its opposite (150° and 210° away): contrast that is easier to balance.

Contrast of text on each color (WCAG 2.2)
ColorWhite textWCAGBlack textWCAG
#88315b7.96:1AAA2.63:1Fail
#00380313.4:1AAA1.56:1Fail
#3ec1cd2.16:1Fail9.71:1AAA
#b4e7b11.39:1Fail15:1AAA
#058c964.03:1AA large text only5.19:1AA

Calculated on your device · formulas checked against known results · How we test

How to use the color palette generator

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Fine-tune a color with the pencil, which opens your device’s color chooser; the edited color is locked automatically.
  6. 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.
  7. 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:

ColorHEXOKLCH
Red#ff0000oklch(62.8% 0.258 29.2)
Lime#00ff00oklch(86.6% 0.295 142.5)
Blue#0000ffoklch(45.2% 0.313 264.1)
White#ffffffoklch(100% 0 0)
Navy #1f4e79#1f4e79oklch(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.

HarmonyHues relative to the anchorCharacter
Analogous−2 to +2 steps of 18–32°Calm, natural, cohesive
MonochromaticSame hue, five lightness levelsSafe for interfaces and charts
Complementary0° and 180°Strong contrast; use the opposite hue as an accent
Split-complementary0°, 150° and 210°Contrast that is easier to balance
Triadic0°, 120° and 240°Lively; let one hue dominate
Tetradic (square)0°, 90°, 180° and 270°Rich; keep most colors muted
Shades and tintsSame hue, mixed with white and black in OKLabOne 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%:

#HEXOKLCHWhite textBlack text
1#1f4e79oklch(41.4% 0.088 249.1)8.66:12.42:1
2#461a23oklch(28.7% 0.068 9.7)14.66:11.43:1
3#758e58oklch(61.3% 0.082 128.8)3.64:15.76:1
4#ffdee2oklch(92.9% 0.037 9.5)1.25:116.79:1
5#a2b68doklch(75% 0.061 129)2.18:19.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

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.

Embed this calculator on your website

Free for any website or blog. Paste this code where you want the calculator to appear:

All free calculator widgets

Last updated: October 15, 2026

Menu

Categories

Finance Calculators30 calculatorsBusiness & Shopping Calculators9 calculatorsHealth & Fitness Calculators13 calculatorsMath & School Calculators23 calculatorsDate & Time Calculators19 calculatorsHoliday Countdowns17 calculatorsEveryday Tools49 calculatorsMic, Camera & Sound Tools10 calculatorsImage & PDF Tools19 calculators

CalcWorthy

AboutContactPrivacy PolicyTerms of Use

Language

Language
EnglishEnglishالعربيةArabicবাংলাBanglaDeutschGermanEspañolSpanishفارسیPersianFrançaisFrenchעבריתHebrewहिन्दीHindiBahasa IndonesiaIndonesianItalianoItalian日本語Japanese한국어KoreanBahasa MelayuMalayNederlandsDutchPolskiPolishPortuguêsPortugueseРусскийRussianไทยThaiTürkçeTurkishУкраїнськаUkrainianاردوUrduTiếng ViệtVietnamese简体中文Simplified Chinese