Ask any question about Tailwind CSS here... and get an instant response.
How do I apply custom colors in Tailwind using the theme configuration?
Asked on Nov 17, 2025
Answer
To apply custom colors in Tailwind CSS, you can extend the default theme configuration in your `tailwind.config.js` file. This allows you to define custom color values that can be used throughout your project.
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
'custom-blue': '#1e40af',
'custom-red': '#dc2626',
},
},
},
}Additional Comment:
- To use these custom colors, apply them as class names like "bg-custom-blue" or "text-custom-red" in your HTML.
- The "extend" key allows you to add to Tailwind's default theme without overwriting it.
- Ensure your build process is set up to watch for changes in your configuration file.
Recommended Links:
