Sub topic 1
The default palette and shade scale
Prerequisites
This chapter assumes you know basic HTML and CSS, including the box model. It also assumes you have used Tailwind utility classes before and have a working Tailwind project or playground. You should recognize hex and RGB color notation, such as #6366f1 or rgb(99 102 241).
How the palette is organized
Tailwind ships with a default palette of named colors. Each color has a scale of shades, written as numbers: 50, 100, 200, and so on up to 900, then 950. A low number is light and a high number is dark.
A color utility joins three parts: a property prefix, a color name, and a shade number.
bg-indigo-600sets the background color.text-slate-900sets the text color.border-emerald-500sets the border color.
The default palette includes gray-like families (slate, gray, zinc, neutral, stone) and hue families such as red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, and rose. The palette also has the single-value colors black, white, and transparent. These take no shade number, so you write bg-white and not bg-white-500.
Reading the shade scale
Shades are not evenly spaced in lightness, but they are designed to be consistent across colors. The same shade number gives a similar visual weight in every family. Because of that, you can swap indigo for emerald and keep the same contrast behavior.
| Shade range | Typical use |
|---|---|
| 50 to 100 | Subtle backgrounds, hover tints |
| 200 to 300 | Borders, dividers, disabled states |
| 400 to 500 | Icons, accents, secondary text on dark backgrounds |
| 600 to 700 | Buttons, links, primary text accents |
| 800 to 950 | Body text, dark backgrounds |
These ranges are conventions, not rules. Treat them as a starting point.
A worked example
The next button uses the palette for its text, its background, and its hover state.
<button class="rounded-md bg-indigo-600 px-4 py-2 text-white hover:bg-indigo-500">
Save changes
</button>The resting background is indigo-600. The hover: variant applies bg-indigo-500 while the pointer is over the button. Moving down the scale to a lighter number is a common way to show that an element is interactive. Some designs go the other way and use a darker shade on hover. Pick one direction and keep it across your project.
Common mistakes
- Using a shade that does not exist. Classes such as
bg-indigo-650orbg-indigo-5generate no CSS, because the default scale has only the listed steps. The element then shows no color and Tailwind gives no error in the browser. - Adding a shade to a single-value color.
text-white-100is not a valid class. - Mixing many color families. Using one gray family, such as
slate, plus one accent color keeps an interface consistent. Mixingslate,gray, andzincproduces slightly different grays that look mismatched next to each other. - Building class names from strings. A class like `
bg-${color}-600` assembled at runtime is never found by Tailwind's source scan, so its CSS is not generated. Write the full class name, or map values to complete class names.
Checking your understanding
Exercise
You write <p class="text-slate-950 bg-slate-50"> and want a slightly darker background that still belongs to the same family. Which class do you change it to, and why is bg-slate-75 not an option?
Show answer
Change it to bg-slate-100 (or bg-slate-200 for a bigger step). The default scale contains only 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, and 950, so bg-slate-75 does not exist and generates no CSS.