DEV Community

Discussion on: Using CSS variables with TailwindCSS

Collapse
 
kachidk profile image
Nwanguma Victor • Edited

Nice article very simple and straight to the point. But each classname color has an opacity
Check this youtu.be/MAtaT8BZEAo and include it.

Collapse
 
deepcodes profile image
Deepankar Bhade

Thanks a ton!
Yes we can do that here too just use rgba instead of hex colors

:root {
  --foreground: rgba(255,255,255,0.5);
  --background: rgba(0,0,0,0.5);;
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kachidk profile image
Nwanguma Victor

Yeah you can hardcode it, but you can't be able use any tailwind opacity classes on it, because each Tailwind classname color has a variable in each class used to represent the opacity in rgba values. Details is in the video