DEV Community

loading...

Discussion on: One line - Dark Mode using CSS

Collapse
jmau111 profile image
Julien Maury • Edited

you are amazing man, I see another catch, though. When you define img as background in css, it seems that your workaround does not work.

Collapse
akhilarjun profile image
Akhil Arjun Author

Well, there are a couple of ways we can achieve that too.
If it is just a div with a background-image set. Then applying filter would not be a problem there, but if that element has some content then the filter might affect it all too. So we might have to check for specialized solutions.
There is a beautiful article on css-tricks regarding the same css-tricks.com/apply-a-filter-to-a....

Hope that helps 😀

Collapse
jmau111 profile image
Julien Maury

thanks a lot, will read that.

Collapse
jmau111 profile image
Julien Maury

you can probably add other stuff such as :

  img, iframe {
    filter: invert(1) hue-rotate(180deg);
  }

works like a charm, but it should be listed

Forem Open with the Forem app