Making single color SVG icons work in dark mode
Another good reason to use the currentColor
value in SVGs.
At first glance, this looks like a terrible idea. But the key is in the implementation. In this case, the implementation is truly awful.
The section on detecting “auto dark theme” is, as far as I can tell, not intended as a joke.
Mind you, this could all be a galaxy-brain idea to encourage more developers to provide their own dark mode styles. (In much the same way that AMP was supposed to encourage better performance.)
Another good reason to use the currentColor
value in SVGs.
Some advice from Andy on creating a dark theme for your website. It’s not just about the colours—there are typography implications too.
On Ev’s blog, Marcin goes into great detail on theming an interface using CSS custom properties, SVG, HSL, and a smattering of CSS filters.
I was kind of amazed that all of this could happen via CSS and CSS alone: the colours, the transitions, the vectors, and even the images.
There’s a good discussion here (kicked off by Jen) about providing different theme-color
values in a web app manifest to match prefers-color-scheme
in media queries.
Styling sheet music …and then unstyling it.