Theme Customisation in CSS
Loading "Customize the Tailwind Theme"
Run locally for transcripts
π¨βπΌ Our app is sort of working, but there are obviously some styles missing.
π¦ It's important to understand that the
tailwind.config.ts
file is completely ignored in Tailwind CSS v4. It will eventually be supported for the stable release, but right now, it's being ignored.π¨βπΌ Ahaaa, that's why! Well, we need to port our theme customisations to the CSS file, then!
Customise the Tailwind theme in CSS
Tailwind CSS v4 lets you extend (or override) the default theme by using CSS variables directly in your CSS.
π° Let me show you an example for the custom
highlight
color we had defined in the Tailwind config.What looks like this in
tailwind.config.ts
...theme: {
extend: {
colors: {
highlight: '#6202FF',
}
}
}
... can be defined like that in the
styles.css
file:@theme {
--color-highlight: #6202ff;
}
π° The Intellisense should give you suggestions for available CSS variables names in the theme.
--color-{name}
will let you define a color value.--breakpoint-{name}
will let you define a screen size value.--font-family-{name}
will let you define a font-family value.
π¦ Here's an exhaustive list of all the Tailwind theme CSS variables available.