Tailwind ships a default palette: slate, indigo, emerald, each with steps 50–950. Utilities cover text (text-indigo-600), background (bg-slate-50), border (border-slate-200), and rings.
Token thinking
Prefer scale steps over arbitrary hex in markup. Designers map brand primary to indigo-600; developers stay consistent. Custom brand colors belong in theme.extend.colors (covered later).
Contrast and accessibility
Pair light backgrounds with darker text steps (bg-indigo-50 + text-indigo-900). Check contrast ratios—utilities make color easy to apply but do not guarantee WCAG compliance.
Important interview questions and answers
- Q: How do you add a brand color?
A: Extend the theme intailwind.config.jsso utilities likebg-brandare generated and purge-safe. - Q: text-white on bg-indigo-400—always safe?
A: Not always. Verify contrast; prefer darker bg steps or larger text for small labels.
Self-check
- What is the difference between
bg-slate-100andtext-slate-100? - Where should one-off hex values live in a Tailwind project?