I'm trying to implement dark mode and want to use CSS variables so that I can change colors easily depending on whether light/dark mode is enabled. I'm using the prefers-color-scheme
media query in order to display the css variable color changes.
The problem I'm facing is that the project I'm working on contains lots of sass variables that appear in thousands of properties and inside dozens of files, inside of a base bootstrap template.
I tried updating the sass variables to have the CSS variable values. e.g $primary = var(--color-primary)
, but this doesn't work.
Is there a way that I can redirect these SASS variables to the CSS ones so they are inherited?
I don't really want to start messing with the base bootstrap template as it's so confusing and difficult to maintain. Ideally, I would just want to edit my variables.scss
file.
Thanks so much!