osgameclones
osgameclones copied to clipboard
Use the new user style preferences feature in browsers to automatically serve dark mode
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.
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.
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.
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.
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.
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. :-)
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.
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.
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