DEV Community

Discussion on: Dark Mode With One Line Of Code

Collapse
 
druiznyc profile image
Daniel Ruiz

If you just use the :not() css selector you don't need the code above. This solves the issue and doesn't waste processor power on converting and unconverting images with the filter tag

.dark-mode :not(img):not(.inverted){ filter: invert(100%) }

Collapse
 
humayunkabir profile image
Humayun Kabir

I tried to resolve the issue according to both Loouis Low and Daniel Ruiz way. Both are great solutions. But facing problem with the background image. Any workaround, guys?