Tailwind's default color palette is excellent, but every brand needs custom colors. Whether you're matching a brand guide or creating a unique aesthetic, extending Tailwind's colors is essential for professional projects.
@theme { --color-brand-500: #3b82f6; } instead of tailwind.config.js. The JavaScript config examples in this article apply to Tailwind v3. See our Tailwind color config guide for v4 syntax.Understanding Tailwind's Color System
Tailwind uses a numeric scale from 50 (lightest) to 950 (darkest) for each color. This creates predictable, accessible color ramps that work across your entire design.
Default Scale: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
Extending the Default Palette
The cleanest approach is extending (not replacing) Tailwind's colors:
Now you can use classes like bg-brand-500, text-brand-700, etc.
Creating Shade Scales
Generating a complete 11-shade scale manually is tedious. Here are better approaches:
Method 1: Online Generators
- UI Colors: uicolors.app/create - Paste your hex, get Tailwind scale
- Tailwind Shades: tailwindshades.com - Auto-generate from single color
- Coolors: coolors.co - Create scales, export for Tailwind
Method 2: Using theme()
Reference existing Tailwind colors in your config:
Method 3: Single Color (Simplified)
If you only need one shade:
Use with: bg-brand, text-brand, etc.
Complete Brand Color System
A professional setup with semantic naming:
Using with theme()
Access your custom colors in CSS or other config values:
Or in CSS with @apply:
Configuration Best Practices
1. Use Semantic Names
Name colors by purpose, not appearance:
- Good:
primary,secondary,accent - Bad:
blue,lightBlue,darkBlue
2. Keep DEFAULT Shade
Always define a DEFAULT shade for simple class names:
3. Document Your System
Add comments explaining color usage:
Opacity Modifiers
Tailwind v3+ supports opacity modifiers out of the box:
Dark Mode Colors
Define different colors for dark mode:
Text that adapts
Or configure globally:
Plugin Recommendations
1. @tailwindcss/forms
Better form styling that respects custom colors:
2. tailwindcss-animate
Smooth animations using your custom colors:
Exporting for Design Tools
Share your Tailwind colors with designers:
For Figma
- Use Tailwind CSS Figma Plugin
- Several community plugins can turn a Tailwind color config into Figma color styles or variables
- Check that the plugin you choose supports your Tailwind version
For Adobe tools
Adobe XD is in maintenance mode. For Illustrator, Photoshop or InDesign, export your palette as an .ASE swatch file (every palette on our palette pages has an .ASE button) and load it into the Swatches panel.
Real Project Example
Here's a complete, production-ready configuration:
Testing Your Colors
- Contrast Check: Test all text/background combinations for WCAG compliance
- Dark Mode: Verify colors work in both light and dark themes
- Color Blind: Use simulators to test accessibility
- Print Styles: Ensure colors translate to @media print
Common Mistakes
1. Replacing Instead of Extending
Don't do this (loses all default colors):
Do this instead:
2. Incomplete Scales
Utilities are only generated for the shades you define, so a missing shade simply has no class (bg-brand-300 won't exist). Define a full 50-950 scale if your team expects every step to be available.
3. Poor Naming
Avoid names tied to specific colors—they become confusing when you rebrand.
Conclusion
Custom colors in Tailwind are straightforward once you understand the config structure. Use extending (not replacing), maintain complete shade scales, choose semantic names, and document your system. With these practices, your Tailwind colors will be maintainable, scalable, and designer-friendly.