Home > Blockchain >  Firefox not respecting user media(prefers-color-scheme: dark)
Firefox not respecting user media(prefers-color-scheme: dark)

Time:04-22

I am using the following css with @media(prefers-color-scheme: dark) in order to display a dark site version to users who have a dark mode selection on OS level. When I switch Dark or Light mode preference via Windows, the site will automatically change in Chrome. However, in Firefox, Opera, Edge it always displays the dark version, no matter the OS preference. Why is this so?

CodePudding user response:

I am of the opinion that you can't do that or only in part to get/read.

You will not get the right settings for the mode selection on OS level with the browser every time for every user.

You got different os's & browser's with different settings what the browser will share.

Check this:

The method by which the user expresses their preference can vary. It might be a system-wide setting exposed by the Operating System, or a setting controlled by the user agent.

Detecting the desire for light or dark color schemes: the prefers-color-scheme feature

How to detect if OS X is in dark mode?

How to detect if the OS is in dark mode in browsers?

How do I detect dark mode using JavaScript?

  • Related