PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Unsolved

Dark mode/light mode favicon not updating

produkt

May 4th, 2025 06:21 AM

The dark mode favicon in Devdojo auth is displaying when my screen is not in dark mode, making the logo invisible. Also relatedly, the favicon does not change at all depending on the light/dark mode on non-auth pages.

bobbyiliev

May 4th, 2025 09:46 PM

Hey!

For me it seems to be working as expected:

Have you made any changes to the default auth package blade templates?

The implementation looks correct:

resources/views/includes/head.blade.php#L37-L38

- Bobby

produkt

May 5th, 2025 09:28 AM

After further testing, it seems the issue is isolated to the Firefox browser. Are you able to test it on your machine in Firefox? Does it work as expected?

bobbyiliev

May 7th, 2025 06:00 AM

Hey! 👋

Yea, seems like you're right. The favicon switching with media="(prefers-color-scheme: ...)" works nicely in Chrome, but as far as I can see Firefox doesn't support media queries on <link rel="icon">. It just grabs the first icon it sees and ignores the rest. 😬

No wonder Firefox is losing market share:

chart

The chart says it all: only ~2.5% vs Chrome's ~70%! 😅

I've not tested it but you could try the following:

<link id="favicon" rel="icon" href="/light.ico" />
<script>
    const favicon = document.getElementById('favicon');
    const darkMode = window.matchMedia('(prefers-color-scheme: dark)');

    const updateFavicon = () => {
        favicon.href = darkMode.matches ? '/dark.ico' : '/light.ico';
    };

    darkMode.addEventListener('change', updateFavicon);
    updateFavicon();
</script>

- Bobby