← All articles · April 30, 2026 · og.hjlabs.in · Updated November 9, 2026

Dark Mode Favicons 2026 — SVG Media Query Trick + Examples

In 2026, dark-mode browser tabs are the default for ~60% of users. A black-on-white favicon disappears completely on a dark Chrome tab. Here's how to design favicons that look correct in both modes.

Generate a dark-mode-aware favicon

Open the full generator →

1 · Source letter, text, emoji, gradient or your own image

2 · Preview how it looks in a light and a dark browser tab

Light
Your site — Home
Dark
Your site — Home
16×16
32×32
48×48
64×64
128×128
180×180
192×192
512×512
iOS home screen
Android maskable

3 · Download everything is rendered in your browser — nothing is uploaded, no limits

favicon.icofavicon-16x16.pngfavicon-32x32.pngfavicon-48x48.pngfavicon-64x64.pngfavicon-128x128.pngapple-touch-icon.pngandroid-chrome-192x192.pngandroid-chrome-512x512.pngmaskable-icon-192x192.pngmaskable-icon-512x512.pngmstile-150x150.pngfavicon.svgsite.webmanifestbrowserconfig.xmlREADME-paste-into-head.html

The problem, visualized

Your beautiful black-on-white favicon was designed for the era of light browser chrome. On a dark tab background, the white square stands out as a glaring rectangle while the black logo inside is a barely-visible smudge.

Approach 1: SVG with prefers-color-scheme (modern, recommended)

Modern browsers support SVG favicons with embedded CSS. Use @media (prefers-color-scheme: dark) inside the SVG:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
  <style>
    .bg { fill: #ffffff; }
    .fg { fill: #000000; }
    @media (prefers-color-scheme: dark) {
      .bg { fill: #1a1a1a; }
      .fg { fill: #ffffff; }
    }
  </style>
  <rect class="bg" width="32" height="32" />
  <text class="fg" x="16" y="22">Y</text>
</svg>

Then in your HTML:

<link rel="icon" type="image/svg+xml" href="/favicon.svg">

Browser support: Chrome 80+, Firefox 110+, Safari 16+. For older browsers, fall back to PNG.

Approach 2: Two PNGs with media query (legacy)

Provide two favicon PNGs and let the browser pick:

<link rel="icon" type="image/png"
      href="/favicon-light.png"
      media="(prefers-color-scheme: light)">
<link rel="icon" type="image/png"
      href="/favicon-dark.png"
      media="(prefers-color-scheme: dark)">

Caveat: only Safari fully respects this. Chrome and Firefox often ignore the media attribute on link tags. The SVG approach is more reliable.

Approach 3: Auto-adaptive with neutral colors

The simplest approach: design your favicon with colors that work on both backgrounds.

Design rules for theme-aware favicons

  1. Use brand colors as the background. Don't rely on tab chrome — own your colored square.
  2. Keep contrast within the icon. The internal contrast (background vs foreground inside the favicon) matters more than contrast against the tab.
  3. Test in both modes. Toggle Chrome/Firefox dark mode and inspect.
  4. Avoid pure white. Pure white favicons look like an empty rectangle on dark tabs.
  5. Avoid pure black. Same problem in light mode.

Examples that get it right

Examples that get it wrong

Generating an adaptive favicon

The generator at the top of this page has a Dark-mode variant toggle: pick the light colours and the dark colours, check the icon in the light and dark tab mock-ups, and the exported favicon.svg carries the @media (prefers-color-scheme: dark) block automatically — alongside the favicon.ico and PNG fallbacks for browsers that ignore SVG. Gradient and emoji modes are naturally theme-adaptive if you would rather not maintain two palettes.

Testing checklist

  1. Open your site in Chrome with system dark mode enabled — favicon visible?
  2. Open in Firefox dark theme — visible?
  3. Open in Safari with dark mode — visible?
  4. Pin tab in Chrome — does the pinned tab icon look right?
  5. Add to iOS home screen on dark wallpaper — apple-touch-icon visible?

Bottom line

The best 2026 strategy: ship one SVG with embedded prefers-color-scheme, plus PNG and ICO fallbacks for older browsers. Use brand colors as the background — never rely on tab chrome to provide contrast. Generate yours in 30 seconds.

Ship a favicon that works in both modes

favicon.svg with embedded prefers-color-scheme, plus the ICO and PNG fallbacks, in one ZIP.

Open the favicon generator →

More from the blog