Dark mode for SVG favicon

Photo by Szabo Viktor on Unsplash

You can embed CSS within an SVG with a <style> element. This means that you can style your icon with inline prefers-color-scheme.

For Safari, it’s a bit different. You need to add a mask-icon. It’s also an SVG, but it has to be made of a single color and placed on a transparent background. You specify the color, so there is no opportunity there for a dark mode situation.

--

--

I drink a lot of tea and build beautiful websites. If you are looking to work together or just start a conversation 👉 https://www.ronaldsvilcins.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ronalds Vilcins

I drink a lot of tea and build beautiful websites. If you are looking to work together or just start a conversation 👉 https://www.ronaldsvilcins.com/