prefers-color-scheme CSS Media Feture

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

User avatar
RuboGubo
New to the forum
New to the forum
Posts: 1
Joined: 2022-06-05, 22:12

prefers-color-scheme CSS Media Feture

Unread post by RuboGubo » 2022-06-05, 22:30

Hi, I have been developing a website, and noticed that "prefers-color-scheme" does not represent the colour scheme of the operating system, which is frustrating. Just wondered if this would be something that could be easily implemented. (see the MDN Docs https://developer.mozilla.org/en-US/doc ... a_features )
I develop Mostly for the Firefox browser, and just thought i would point it out. :)

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35402
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: prefers-color-scheme CSS Media Feture

Unread post by Moonchild » 2022-06-05, 22:41

We support this, but it is supported under the user's explicit control and choice.
This also has the side effect desired by our users that it is not a property whereby the user's system can be fingerprinted (since it is unrelated to the O.S. color scheme in use).
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 644
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California
Contact:

Re: prefers-color-scheme CSS Media Feture

Unread post by RealityRipple » 2022-06-06, 01:41

Preferences > Content > Fonts & Colors > Colors... > Web Page Color Scheme > Use light colors / Use dark colors.

Exposing the OS Color Scheme directly would not only be a fingerprinting risk, but could be used to better fake OS-styled dialogs and prompts on unsuspecting, inexperienced users.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1478
Joined: 2018-10-28, 19:56
Location: Georgia

Re: prefers-color-scheme CSS Media Feture

Unread post by athenian200 » 2022-06-06, 04:41

Another thing that might be worth considering is that just because the user wants a dark theme on their OS, that may not mean they actually want all web pages serving up a dark theme to match it. That is, someone could want a dark theme on the OS but a light theme for web pages, or perhaps they want a light theme in the OS but prefer to see the dark theme of web pages. For instance, on the Pale Moon forums I use a dark theme, but I often use a light theme on the OS itself.

In any case, there is precedent for the concept. We've had a "Page Style" option under the View menu for ages, which allows switching between various alternate CSS stylesheets provided by the author. So in general our thinking is that if the author is going to provide multiple CSS stylesheets to affect the page's color scheme, then that should be no different and the user should be allowed to choose which style they prefer.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: prefers-color-scheme CSS Media Feture

Unread post by moonbat » 2022-06-15, 09:20

The extensions AutoPageColor (mine) and Swarth when used together both give you full control over automatic light/dark mode on a per site and time of day basis.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

Locked