DEV Community

Farai Gandiya
Farai Gandiya

Posted on • Originally published at codelab.farai.xyz on

2

Give Your Illustrations Dark Mode With This Simple Trick (SPOILER: It's a CSS Filter)

Give Your Illustrations Dark Mode With This Simple Trick (SPOILER: It's a CSS Filter) was first published on Farai's Codelab.


filter: invert(100%);—that’s it!

Ok fine, it won’t work all most of the time (it’s terrible on actual photos) but it’s good for illustrations with simple color palettes, like xkcd comics.

Two copies of a simply drawn XKCD comic, one white on black the other black on white

Wisdom of The Ancients by xkcd Transcript

On my site, I put that CSS in a class invert-hack which I place on any illustrations I want to flip to dark mode.


Thanks for reading! If you liked this post, consider supporting my work by:

You can also subscribe to my newsletter.

Have feedback? Send an email to gandiyafarai+feedback at gmail dot com

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay