Loading
Current section: Color Design Tokens 10 exercises
Problem

CSS Variables

Transcript

00:00 The main reason why we have done any of this is to be able to have themable colors or dark modes like UIs. The ability to change colors of our design tokens without to have to change the classes and have things still make sense. You can have border red 500 and then change it to blue

00:18 then it gets really confusing but if it's called border muted it makes a lot of sense to be any color that is sort of muted. So there's a lot to unpack here but the TLDR is we're going to use CSS variables that allows us to redefine colors at runtime and it's really powerful. And to be

00:38 able to do this in Tailwind version 3, remember we'll talk about version 4 later, but in v3 we need to convert our hex colors to HSL or RGB or any color format that supports an alpha channel for transparency. Now I don't want to get in too much details here, I recommend you reading the

00:56 documentation below and if you're really interested in learning about CSS variables and even Tailwind plugins, I have a workshop called Multi-Theme Strategy in ProTailwind and there's a link below and you should go check that out. But for now, read the instructions and go on with the exercise. It's

01:13 a bit of a long one but there's all the information you need to succeed. I'll see you on the other end, good luck!