osgameclones icon indicating copy to clipboard operation
osgameclones copied to clipboard

Use the new user style preferences feature in browsers to automatically serve dark mode

Open ghost opened this issue 6 years ago • 8 comments

https://blog.chromium.org/2019/06/chrome-76-beta-dark-mode-payments-new.html prefers-color-scheme works across all major browsers at this point.

ghost avatar Aug 13 '19 16:08 ghost

I don't think we need to implement now.

The prefers-color-scheme is in Draft status. The W3C is working the Media Queries 4 specification, and the prefers-color-scheme is in the Media Queries 5 specification.

If the browsers implemented it, than good for them, but the Mozilla said it's just the experimental feature.

I think we need to wait to the W3C to ending working on this specification before we implement it, because the feature behavior expected to change.

pehsa avatar Sep 05 '19 09:09 pehsa

W3C moves very slowly on such things though :sweat_smile: . I prefer to see if major browsers implement them https://caniuse.com/#search=prefers-color-scheme Looks like major browsers already support it.

cxong avatar Sep 05 '19 22:09 cxong

It works in both firefox and chrome (with a flag, but not for long). I've already supported it on my website for a few weeks and tested it in both browsers, both desktop and mobile, so it does work.

OvermindDL1 avatar Sep 05 '19 22:09 OvermindDL1

i'm not sure about the flag part but it works without any configuration on sites like mozilla's bugzilla, apple music, twitter, etc.

so many major sites are implementing it I seriously doubt that breaking changes would be made.

ghost avatar Sep 05 '19 23:09 ghost

i'm not sure about the flag part but it works without any configuration on sites like mozilla's bugzilla, apple music, twitter, etc.

Chrome for desktop doesn't have it enabled by default (mobile chrome does) but you can enable it with a commandline flag is what I meant. :-)

OvermindDL1 avatar Sep 06 '19 14:09 OvermindDL1

the only thing thing that needs to be enabled now is the "force dark mode" tag (chrome://flags/#enable-force-dark) which does what most extensions do. Support for the user styles thing is working for me on the latest chrome and edge (chromium) stable.

ghost avatar Sep 06 '19 14:09 ghost

Ah there is a flag for it now! I'm still using the commandline arg from >4 months ago back from when the flag didn't exist. :-)

EDIT: The flag does not in my desktop chrome version: Version 76.0.3809.100 (Official Build) (64-bit) No pending update notification.

OvermindDL1 avatar Sep 06 '19 14:09 OvermindDL1

On a related note, the "Dark Theme" link should change to "Light Theme" when the user is already on the dark theme or change it into a dropdown, with three options: light, dark and device default

cxong avatar Sep 13 '21 23:09 cxong