When the browser is in incognito mode, the tab is black. It can make the favicon either not super visible, or even invisible in worst case. This isn’t great. I’ve seen some post offering a way to detect the dark mode and change the favicon accordingly but after tries : incognito mode isn’t detected as dark mode. Beside, some people offered ways to detect incognito mode with javascript, but they’re apparently not reliable at all.
Does anyone has a reliable way to handle that? (beside making the favicon colors as visible in light and dark)
Thank you
2
Answers
Okay I'm using this package for reliable (apparently) incognito mode detection : https://github.com/Joe12387/detectIncognito, and
For the dark mode.
In the html I have :
(notice the class)
Then in a js file :
Then where I init my things (depending on the framework)
It works great. Tested on chrome, firefox, edge.
For your solution you can create 2 functions
To detect Dark Mode: isDarkMode
To Detect incognito Mode : isIncognitoMode
here is the code you can refer :
use isIncognitoAndDarkMode function to get your output