What it does
Tailwind CSS names each color's shades 50, 100, 200 and so on up to 900 and 950, from lightest to darkest. This generator builds the same kind of scale from one color of your own, so it fits beside the built-in colors in a Tailwind project. Nothing about the output is Tailwind-only: the CSS variables and JSON exports work as a general color shades generator for any design system.
How the scale is built
The generator works in OKLCH, which describes a color by lightness, chroma (how colorful it is) and hue. Equal steps in OKLCH lightness look roughly equal to the eye, which makes it a good space for building even scales.
- Target lightness for each stop. We took the 17 chromatic families of the Tailwind CSS v4 default palette (red to rose, leaving out the grays) and used the median lightness at each stop.
- Chroma profile. For each of those families we divided each stop's chroma by the family's highest chroma, then took the median at each stop. Colors are most saturated around 500 and 600 and fade toward both ends.
- Your color sets the level. Your color's chroma and its position on that profile give a peak chroma for the whole scale, and every stop is generated at your color's hue (very pale tints can drift a few degrees after rounding to HEX).
- Your color stays exact. It goes at the stop whose target lightness is closest to its own (or at 500 if you choose), and that stop is your input unchanged.
- Every stop fits on screen. A stop that would fall outside sRGB is brought inside with the CSS Color 4 gamut mapping method, which keeps lightness and hue and lowers only chroma.
| Stop | Target lightness | Chroma (share of peak) |
|---|---|---|
| 50 | 97.7% | 7% |
| 100 | 95.1% | 15% |
| 200 | 90.2% | 34% |
| 300 | 83.3% | 58% |
| 400 | 74.6% | 82% |
| 500 | 68.5% | 96% |
| 600 | 59.2% | 99% |
| 700 | 51.4% | 86% |
| 800 | 44.8% | 72% |
| 900 | 39.6% | 55% |
| 950 | 27.9% | 37% |
When you choose Always 500, the lightness curve is stretched so 500 lands on your color and the other stops spread evenly toward white and black. A very light or very dark color at 500 crowds the stops on one side; the tool tells you when that happens.
Worked example
Start with #4f46e5, which is oklch(51.06% 0.2301 276.97). Its lightness, 51.06%, is closest to the 700 target of 51.4%, so it becomes brand-700. The tool then gives 50 #f4f7ff, 100 #e7edff, 200 #d2dbff, 300 #b7c2ff, 400 #95a1ff, 500 #7f89ff, 600 #625dff, 800 #413cbb, 900 #373794 and 950 #1e1f58.
Brand-700 has a contrast ratio of 6.29:1 on white, so it passes AA for normal text, and 3.34:1 on black, which does not. Brand-600 (#625dff) is 4.64:1 on white and 4.53:1 on black, just passing on both. With Always 500 the same color becomes brand-500, and 400 moves to #6765ff and 600 to #423dbe.
The 12-step UI scale
Some design systems number their steps by job instead of by lightness. Radix Colors popularized a 12-step model in which each step has a use. This tool follows the same 12 uses with its own lightness targets:
| Step | Use | Target lightness |
|---|---|---|
| 1 | App background | 99.0% |
| 2 | Subtle background | 97.5% |
| 3 | Component background | 95.0% |
| 4 | Hovered component | 92.5% |
| 5 | Pressed component | 89.5% |
| 6 | Subtle border | 86.0% |
| 7 | Border | 81.0% |
| 8 | Strong border | 74.5% |
| 9 | Solid | Your color |
| 10 | Hovered solid | Your color, 4.5 points darker |
| 11 | Low-contrast text | 50.0% |
| 12 | High-contrast text | 27.0% |
Steps 1 to 8 are light tints for backgrounds and borders. Step 9 is your color unchanged, and step 10 is 4.5 lightness points darker for its hover state (lighter instead if your color is very dark). Steps 11 and 12 are text colors: we checked every hue at three chroma levels, and step 11 always has at least 4.5:1 contrast on step 2 and step 12 at least 7:1. For #4f46e5, steps 1 to 4 are #fafbff, #f3f6ff, #e7edff and #dce4ff, and step 12 is #1d1e54.
Using the export
In Tailwind CSS v4, paste the @theme block after @import "tailwindcss"; in your main CSS file; it creates bg-brand-500, text-brand-700 and the rest, plus variables such as var(--color-brand-500). In v3, merge the object into theme.extend.colors in tailwind.config.js. The CSS variables export gives plain custom properties such as --brand-500 for projects without Tailwind.
Common mistakes
- Assuming 500 is the base. Tailwind's 500 shades sit at about 69% lightness. A darker brand color is closer to 600 or 700, and forcing it to 500 squeezes the dark end of the scale.
- Reading contrast from the stop number. Yellow at 500 is far lighter than blue at 500. Use the contrast column, not the number, to choose text colors.
- Expecting identical results to Tailwind's colors. Tailwind's own palette shifts hue slightly between stops and was tuned by hand. This tool keeps one hue for the whole scale, so a scale built from red-500 is close to, but not the same as, Tailwind's red.
Tailwind CSS is made by Tailwind Labs. Dev Kit Bag is not affiliated with or endorsed by Tailwind Labs.