How to Generate a Custom Tailwind CSS Color Scale
Tailwind's built-in color palette covers most needs, but brand colors rarely match a pre-defined shade. The Tailwind Color Scale generator takes any base color and produces a complete 50-950 scale that follows Tailwind's naming convention and lightness distribution — ready to paste into your tailwind.config.js.
Why Generate Custom Scales?
Brand colors need full shade ranges for different UI states: 50-100 for backgrounds, 200-300 for borders, 400 for secondary text, 500 for the base brand color, 600-700 for hover states, 800-900 for dark text. Tailwind's built-in colors provide this range, but custom brand colors don't — the scale generator fills this gap.
Generating Your Scale
Enter your brand color; it becomes the 500 shade exactly. The tool builds the other ten shades by moving HSL lightness up towards 96% and down towards about 10% while keeping the hue — a simple, predictable method, but not a perceptual one, as the measurement below shows. Output is ready for a Tailwind v3 tailwind.config.js (theme.extend.colors) or as CSS variables.
Checking Scale Quality
There is no contrast checker in the tool, so check pairs yourself before shipping. We compared its scale for Tailwind's own blue-500 (#3b82f6) with Tailwind v3.4's blue palette, using OKLCH lightness (L, 0–1, computed with culori 4.0.2; script in our test folder, October 13, 2026).
| Shade | Tool | L | Tailwind blue | L |
|---|---|---|---|---|
| 50 | #f1f4f9 | 0.966 | #eff6ff | 0.970 |
| 200 | #c8d9f3 | 0.881 | #bfdbfe | 0.882 |
| 500 | #3b82f6 | 0.623 | #3b82f6 | 0.623 |
| 700 | #0848b1 | 0.437 | #1d4ed8 | 0.488 |
| 900 | #0a2551 | 0.273 | #1e3a8a | 0.379 |
| 950 | #06152d | 0.198 | #172554 | 0.282 |
The light end matches Tailwind closely (but greyer: #f1f4f9 against #eff6ff). The dark end runs much darker — the tool's 900 is about as dark as Tailwind's 950 would be if it continued — so tool-generated 800–950 shades suit near-black text more than Tailwind-style deep blues. Neither scale has equal steps: Tailwind's own lightness steps range from 0.038 to 0.097. Contrast to check: 500 on white is 3.68:1 for both, below the 4.5:1 that WCAG 1.4.3 requires for body text, so use 600 or 700 for text on light backgrounds (the tool's 700 on its 50 is 7.41:1; Tailwind's is 6.16:1).
Integration with Tailwind
Paste the generated config into your tailwind.config.js:
module.exports = {
theme: {
extend: {
colors: {
brand: {
50: '#fef2f2',
100: '#fde8e8',
...
900: '#7f1d1d',
950: '#450a0a',
}
}
}
}
}This creates utilities like bg-brand-500, text-brand-900, border-brand-200 throughout your project.
In Tailwind CSS v4, which configures themes in CSS rather than in tailwind.config.js, put the same values in an @theme block — --color-brand-500: #3b82f6; and so on — and utilities such as bg-brand-500 are generated from them.
Frequently Asked Questions
How do I create a custom color scale for Tailwind?
How many shades does Tailwind use per color?
Can I use multiple custom color scales?
- [1]Tailwind CSS v3 documentation: Customizing colors (theme.extend.colors; default palette) ↗
- [2]Tailwind CSS v4 documentation: Theme variables (@theme, --color-*) ↗
- [3]Björn Ottosson (2020): A perceptual color space for image processing (OKLab) ↗
- [4]culori 4.0.2 documentation (OKLCH conversion, WCAG luminance) ↗
- [5]W3C WCAG 2.2: Understanding SC 1.4.3 Contrast (Minimum) ↗
