Ask any question about Tailwind CSS here... and get an instant response.
Post this Question & Answer:
How can I create a custom color palette with Tailwind CSS?
Asked on Apr 11, 2026
Answer
To create a custom color palette in Tailwind CSS, you need to extend the default theme in your Tailwind configuration file. This allows you to add new colors or modify existing ones.
<!-- BEGIN COPY / PASTE -->
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
brand: {
light: '#3AB0FF',
DEFAULT: '#1A73E8',
dark: '#004BA0',
},
},
},
},
}
<!-- END COPY / PASTE -->Additional Comment:
- Use the "extend" key to add new colors without overriding the default palette.
- Define colors using a nested object structure for shades, like "light", "DEFAULT", and "dark".
- After configuring, you can use these colors in your HTML with classes like "bg-brand-light" or "text-brand-dark".
- Run "npx tailwindcss build" to apply the changes if using a CLI setup.
Recommended Links:
