Ask any question about Tailwind CSS here... and get an instant response.
Post this Question & Answer:
How can I create a custom color palette for my Tailwind project?
Asked on Mar 30, 2026
Answer
To create a custom color palette in your Tailwind project, you can extend the default theme configuration in the `tailwind.config.js` file. This allows you to add or modify colors to suit your design needs.
<!-- BEGIN COPY / PASTE -->
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
primary: '#1D4ED8',
secondary: '#9333EA',
accent: '#F59E0B',
},
},
},
}
<!-- END COPY / PASTE -->Additional Comment:
- Use the `extend` key to add new colors without overriding the default palette.
- Define colors using hex codes, RGB, or HSL values as needed.
- After updating the configuration, rebuild your CSS to apply changes.
- Custom colors can be used in your HTML with class names like `bg-primary` or `text-secondary`.
Recommended Links:
