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

RuboGubo

prefers-color-scheme CSS Media Feture

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
Project founder
Project founder
Posts: 39699
Joined: 2011-08-28, 17:27
Location: Sweden

Re: prefers-color-scheme CSS Media Feture

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).
"Sales hates anything that can't be turned into a confident sentence." - anonymous warehouse worker
"Why debate someone you fundamentally don't trust?" - Dario Amodei
"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
Keeps coming back
Keeps coming back
Posts: 958
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: prefers-color-scheme CSS Media Feture

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: 1939
Joined: 2018-10-28, 19:56
Location: Georgia

Re: prefers-color-scheme CSS Media Feture

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.
"Linux makes everything difficult." -- Lyceus Anubite
"Linux is a cancer that attaches itself in an intellectual property sense to everything it touches. That's the way that the license works." -- Steve Ballmer
"We always overestimate the change that will occur in the next two years and underestimate the change that will occur in ten." -- Bill Gates

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

Re: prefers-color-scheme CSS Media Feture

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
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Jabber: moonbat@hot-chili.net