ColorsNew

Tailwind Color Palette Generator in OKLCH

Generate Tailwind shades 50 to 950 from one colour in OKLCH and copy v4 @theme or v3 config

100% client-side — your data never leaves your browserNo data stored or uploadedFree for lifetime · No signup
Presets
Shades 50–950 (click a swatch to copy its hex)

★ marks your exact input colour. W/B are WCAG 2 contrast ratios against white and black text.

CSS (paste into your main stylesheet)
@theme {
  --color-brand-50: oklch(97.1% 0.014 259.8);
  --color-brand-100: oklch(93.2% 0.033 259.8);
  --color-brand-200: oklch(88.2% 0.058 259.8);
  --color-brand-300: oklch(80.9% 0.096 259.8);
  --color-brand-400: oklch(70.7% 0.153 259.8);
  --color-brand-500: oklch(62.3% 0.188 259.8);
  --color-brand-600: oklch(54.6% 0.188 259.8);
  --color-brand-700: oklch(48.8% 0.173 259.8);
  --color-brand-800: oklch(42.4% 0.147 259.8);
  --color-brand-900: oklch(37.9% 0.12 259.8);
  --color-brand-950: oklch(28.2% 0.09 259.8);
}

Use it as bg-brand-500, text-brand-700, border-brand-200 and so on.

How the shades are generated

Tailwind's built-in colours come in eleven steps: 50, 100, 200 through 900, and 950. To make a custom Tailwind colour that sits comfortably beside them, this generator works in OKLCH, the colour space Tailwind CSS v4 uses for its own default palette. OKLCH describes a colour by perceptual lightness (L), chroma (C, roughly saturation) and hue (H). Unlike HSL, equal steps in OKLCH lightness look like equal steps to the eye, so a ramp built on it does not have the muddy middle or the jump between 400 and 500 that HSL-based generators often produce.

Your base colour is converted from sRGB to OKLCH using Björn Ottosson's published OKLab matrices. It is placed on the shade whose target lightness is closest, using targets modelled on Tailwind v4's default blue (about 97% for 50, 62% for 500 and 28% for 950). You can override that with Base colour becomes, for example to force a brand colour to be exactly 600. The other shades are spaced around it so lightness always decreases from 50 to 950, chroma follows a curve that is low at the pale end and peaks around 500 to 600, and hue is held constant.

Some combinations of lightness, chroma and hue do not exist on an ordinary sRGB screen, especially bright yellows and very saturated blues. Each shade is checked and, if it falls outside sRGB, its chroma is reduced step by step until it fits, keeping lightness and hue unchanged. That is why the most saturated shades of some colours look slightly calmer than the input. The shade marked with a star is your exact input.

Contrast on every swatch

Each swatch shows its WCAG 2 contrast ratio against white and against black text, with the level it reaches: AA needs 4.5:1 for body text, AAA needs 7:1, and AA Large needs 3:1 for text around 24px, or 19px bold. Use this to choose pairings before you write any classes. On typical generated palettes, white text reaches AA from about 600 or 700 upwards and black text reaches it on 50 to roughly 500, but the crossover point shifts with hue and with where your base colour landed, so check the numbers rather than assume. The swatch label switches between black and white to whichever contrasts better. Click any swatch to copy its hex value.

Tailwind v4 and v3 output

Tailwind v4 is configured in CSS. Copy the @theme block into the stylesheet that imports Tailwind and you immediately get bg-brand-500, text-brand-700, border-brand-200 and every other colour utility for your name. The values are written as oklch() so they match the format of the built-in palette. If you add a second custom colour, generate it separately and paste its lines into the same @theme block.

Tailwind v3 reads colours from tailwind.config.js. The v3 tab writes a theme.extend.colors object with hex values, which keeps the default palette and adds yours alongside it.

The colour name is lowercased and hyphenated so it is a valid CSS custom property and class name. All conversions run in your browser in plain TypeScript. To convert a single colour between formats, use the Color Converter.

How to use the Tailwind Color Palette Generator in OKLCH tool

  1. 1

    Enter a base colour

    Pick a colour or paste a hex code, or start from a preset such as Brand blue, Emerald or Rose.

  2. 2

    Name the colour

    Type the name you want in class names, such as brand or primary.

  3. 3

    Review the shades

    Check the 50 to 950 swatches and their contrast against white and black; pin the base to a specific shade if needed.

  4. 4

    Copy the config

    Copy the Tailwind v4 @theme CSS or the v3 tailwind.config.js colours object.

Frequently asked questions

How do I add custom colors in Tailwind CSS v4?

Define CSS variables named --color-<name>-<shade> inside an @theme block in your main stylesheet, for example --color-brand-500: oklch(62.3% 0.188 259.8);. Tailwind then generates bg-brand-500, text-brand-500 and the rest.

How do I add custom colors in Tailwind v3?

Add them under theme.extend.colors in tailwind.config.js as an object of shades, such as brand: { 50: '#f0f6ff', 500: '#3b82f6' }. Using extend keeps the default palette available.

Why does the generator use OKLCH instead of HSL?

OKLCH lightness is perceptually uniform, so shades look evenly spaced, and it is the format Tailwind v4 uses for its built-in colours. HSL lightness does not match perceived brightness across hues.

Will my exact brand colour appear in the palette?

Yes. The base colour is kept unchanged on the shade with the closest lightness, marked with a star, and you can choose a different shade for it with the Base colour becomes setting.

Are these the same values as Tailwind’s own palette?

No. Tailwind’s default colours were tuned by hand. This tool follows a similar lightness and chroma curve, so custom colours sit well beside them, but it will not reproduce the official values exactly.

Related on TechLogHub

Get the next tool before you need it

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.