DEV Community

Discussion on: Easiest way to do a dark theme with CSS vars (and JS!)

Collapse
 
crongm profile image
Carlos Garcia ★

This is indeed a very simple solution to a problem that can get too big. With my last employer we needed to implement a dark theme for accessibility, and this was my very first option to use.

Sadly we needed to support IE11 users (yes, in 2019). There were other proposals but nothing was as effective and easy as this one. Sadly I had to leave the company before I saw the dark theme being implemented, so I have no idea how they solved their problem to give more insight.

Collapse
 
corentints profile image
Corentin

Yes unfortunately CSS variables are not implemented in IE. There are other ways to do this, such as creating a second CSS file containing our dark theme, but it's not really ideal either. :(

Collapse
 
janhommes profile image
Jan Hommes

But there is a pollyfill for IE11. Worked very well for me.

Thread Thread
 
corentints profile image
Corentin

Ok! That’s nice :)