Skip to content
Advertisement

CSS variable won’t get set | Electron

I’m currently having an issue with CSS variables not being set, I’m using electron and im trying to set it like this:

JavaScript

And i’ve my variables defined like so:

JavaScript

The color is printed, but the variable is not being set. I’ve seen ‘BlinkFeatures’ and i’ve enabled those too, i still can’t get it to work. Anyone know what’s going on?

Advertisement

Answer

I think this is a problem of css specificity. :root points to the document trees root (HTML tag) and so does document.documentElement except :root has higher specificity (as seen here)

To solve this problem you should probably set the variable overrides to e.g. body tag or change :root {} to html {}

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement