DEV Community

Discussion on: Poor Man's Dark Mode Using CSS Filter

Collapse
 
joeberetta profile image
Joe Beretta • Edited

Hi Rik!
You would to do it more shortener

:not(img) { filter: invert(100%) } 
Enter fullscreen mode Exit fullscreen mode

This selector will match everything(even html and body) except img tag)

Collapse
 
rikschennink profile image
Rik Schennink

Apart from selector performance, which often is negligible, I wonder if filtering every element OR only the top one would result in a noticeable rendering performance. Also, would this not result in multiple elements inverting their parent element filter?