Bug 407358 - Prepare for new CSS #prefers-color-scheme
Summary: Prepare for new CSS #prefers-color-scheme
Status: RESOLVED NOT A BUG
Alias: None
Product: plasma-browser-integration
Classification: Plasma
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-09 10:33 UTC by postix
Modified: 2021-06-16 18:28 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2019-05-09 10:33:51 UTC
The browsers developers plan to introduce a new CSS class #prefers-color-scheme in their recent Media Queries Level 5 revision. [1][2]

This will allow websites to ask the operating system which color scheme it prefers: no-preference | light | dark
and then to display the website content adjusted.

This obviously requires the support of the underlying system to tell which color scheme it currently uses.


[1] https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme
[2] https://stuffandnonsense.co.uk/blog/redesigning-your-product-and-website-for-dark-mode
Comment 1 Kai Uwe Broulik 2019-05-09 10:57:05 UTC
Thanks for your suggestion. However, doesn't that need support in the browser reading the setting or theming?
I don't think there's a way for our extension to set a custom media query to tell the website prefer dark mode? There's matchMedia API to query media from JavaScript but there doesn't seem to be a way to write to them or add custom ones.
Comment 2 postix 2019-05-09 11:37:54 UTC
I'm afraid I don't know about that exactly, but here's what I found out so far:


The Firefox 67 seems to implement [1][2] something called
> "LookAndFeel::GetInt(LookAndFeel::eIntID_SystemUsesDarkTheme, 0)"
which they use to determine which color scheme is used on OSX, Windows and GTK. [3][4]

[1] https://github.com/mozilla/gecko-dev/blob/master/widget/LookAndFeel.h
[2] https://github.com/mozilla/gecko-dev/blob/master/widget/nsXPLookAndFeel.cpp
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1525775
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1461538


So I feel this feature request may be closed, as there seems nothing to do to at least support the FireFox 67+ as it uses GTK anyway?
Is there something similar for Qt, that may be used in the Falkon browser or other applications like pdf readers?

I leave it to you to keep the topic open or to close it. :)
Comment 3 Kai Uwe Broulik 2019-05-09 12:53:35 UTC
I just checked in Chrome, when I check the "Prefer dark scheme" in kde-gtk-settings I have it use dark UI. I didn't manage to get the media stuff to work, though, despite using Chrome 76 unstable or something.
Given Chrome already reads the appropriate setting, it's just a matter of time for it to also support the media query properly.
The fact that the GTK settings stuff is a bit separate is obviously an issue but separate from this.

We don't have a "dark mode" in KDE applications. What I use in settings to identify them as dark is whether the HSV value of the window color is below 192 :D
Comment 4 Nate Graham 2019-05-09 14:59:08 UTC
Yeah, maybe we just need to have the color schemes set the "I'm a dark theme" bit somehow.
Comment 5 Christoph Feck 2019-05-21 19:53:39 UTC
Is 'plasmashell' or 'plasma-browser-integration' the right component?
Comment 6 postix 2019-05-22 10:12:55 UTC
> We don't have a "dark mode" in KDE applications.
I like it how it can be done in MacOS by a toggling hot key [1].

> Is 'plasmashell' or 'plasma-browser-integration' the right component?
The title of this report is very specific. Maby I should rename it or open another one, like "introduce an option to set and determine light / dark mode inter alia  for CSS #prefers-color-scheme." :)

[1] http://osxdaily.com/2019/01/29/toggle-dark-mode-light-mac-via-spotlight/
Comment 7 postix 2021-01-12 15:48:51 UTC
Could someone change this to "wishlist" please and confirm that this still something generally desired?
Comment 8 postix 2021-06-16 18:17:07 UTC
I don't think anyone is really interested in it.
Comment 9 Kai Uwe Broulik 2021-06-16 18:28:52 UTC
Sorry, Firefox seems to support that out of the box in conjunction with out GTK color scheme sync. Not sure about chrome, though.