To use custom brand colors in Tailwind CSS, you would typically define them in your
tailwind.config.js
file under
theme.extend.colors
. This adds your custom colors to Tailwind's default palette.
tailwind.config.js
:
module.exports = {
theme: {
extend: {
colors: {
'brand-primary': '#3490dc', // Example: A nice blue
'brand-secondary': '#ffed4a', // Example: A bright yellow
'brand-accent': '#e3342f', // Example: A strong red
},
},
},
plugins: [],
}
With the configuration above, you could then use classes like
bg-brand-primary
,
text-brand-secondary
, etc.
Since we are using the CDN and cannot modify
tailwind.config.js
directly in this HTML file, we will simulate these custom colors using Tailwind's arbitrary value syntax.
This button simulates
bg-brand-primary
(e.g., '#3490dc'):
Actual class used:
bg-[#_3490dc]
. With config:
bg-brand-primary
.
This text simulates
text-brand-secondary
(e.g., '#ffed4a') on a dark background for contrast:
Important Announcement!
Actual class used:
text-[#_ffed4a]
. With config:
text-brand-secondary
.
This div simulates a
border-brand-accent
(e.g., '#e3342f'):
Actual class used:
border-[#_e3342f]
. With config:
border-brand-accent
.