Menu

1 / 2

Which Theme Does Your SVG Favicon Follow When Windows and the Browser Disagree?

DEV Community: css·Axialis Software·11 days ago
#AypdHw08
#devtocss#devto#dev#scheme#dark
Long article (654 words) — no AI summary yet.
Reading 0:00
15s threshold

Set Windows to light mode and the browser to dark. Now look at the tab. Which color is your favicon, and can you still see it?

A favicon that uses "prefers-color-scheme" has two palettes. The tab has a background of its own. To see how those interact, record three things side by side: the preference reported by the page, the color of the favicon in the tab, and the color behind it.

Illustration of possible outcomes. The test uses the actual tab strip in Chrome and Firefox.

Build the SVG probe

Save this as adaptive.svg . Both palettes use the same shape. The light preference gets dark ink, and the dark preference gets pale yellow.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> <style> .mark { fill: #25213c; } @media (prefers-color-scheme: dark) { .mark { fill: #f7e8ae; } } </style> <path class="mark" fill-rule="evenodd" d="M8 1 15 8 8 15 1 8ZM8 5 5 8 8 11 11 8Z"/> </svg>

Enter fullscreen mode

Exit fullscreen mode

Save this as index.html in the same folder.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.