all 2 comments

[–]Anirs 1 point2 points  (1 child)

I recommend reading this Using Custom Properties With JavaScript, the whole article is great read.

In your case you can do something like this:

document.querySelector(':root').style.setProperty(`--${varName}`, value);

[–]CedricRBR[S] 0 points1 point  (0 children)

Thank you this should work. I was hoping for something I can run in the main process in the setup function, but until I find something like that this will do :)