Ask any question about Tailwind CSS here... and get an instant response.
How can I customize the color palette in Tailwind?
Asked on Nov 02, 2025
Answer
To customize the color palette in Tailwind CSS, you can extend the default theme in your Tailwind configuration file. This allows you to add new colors or override existing ones to suit your design needs.
<!-- BEGIN COPY / PASTE -->
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
primary: '#1D4ED8',
secondary: '#9333EA',
customGray: {
light: '#F3F4F6',
DEFAULT: '#9CA3AF',
dark: '#4B5563',
},
},
},
},
}
<!-- END COPY / PASTE -->Additional Comment:
- Use the "extend" key to add new colors without removing the default palette.
- Define colors using hex codes, RGB, or HSL values as needed.
- Nested color objects (e.g., "customGray") allow for shades and variations.
- After configuration, use your custom colors in your HTML with classes like "bg-primary" or "text-secondary".
Recommended Links:
