Implement LookAndFeel::eIntID_SystemUsesDarkTheme
Categories
(Core :: Widget: Gtk, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
References
Details
Attachments
(1 file)
1.46 KB,
patch
|
heycam
:
review+
karlt
:
review+
|
Details | Diff | Splinter Review |
Over in bug 1494034 we're adding support for the CSS 'prefers-color-scheme'
media query. The platform info to support that comes from
"LookAndFeel::GetInt(LookAndFeel::eIntID_SystemUsesDarkTheme, 0)"
which appears to be implemented for OSX and Windows, but not GTK:
https://searchfox.org/mozilla-central/search?q=eIntID_SystemUsesDarkTheme
Does GTK have an API to answer if the current theme is "light" or "dark"?
If not, can we synthesize an answer based on some fg/bg colors?
Assignee | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
(In reply to Mats Palmgren (:mats) from comment #0)
Does GTK have an API to answer if the current theme is "light" or "dark"?
If not, can we synthesize an answer based on some fg/bg colors?
This sounds like a reasonable thing to do if there's no reliable way to know if the theme is dark or light.
Comment 2•5 years ago
|
||
Bug #1461538 has some prior art on GTK dark themes, even if it’s not been going well.
Assignee | ||
Comment 3•5 years ago
|
||
This seems to work for me locally at least:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=f6d56f8d470711dc1df9d4015f9897beb6fcd2f8
Assignee | ||
Comment 4•5 years ago
|
||
Comment 5•5 years ago
|
||
Comment on attachment 9044464 [details] [diff] [review] fix Review of attachment 9044464 [details] [diff] [review]: ----------------------------------------------------------------- This looks OK. Since it's Gtk related I'd like to get Karl's sign off.
Comment 6•5 years ago
|
||
Comment on attachment 9044464 [details] [diff] [review] fix >+ // colors instead, by converting them to HSV and comparing the V part. >+ uint16_t hue, sat, fg_v, bg_v; >+ uint8_t alpha; >+ NS_RGB2HSV(fg, hue, sat, fg_v, alpha); >+ NS_RGB2HSV(bg, hue, sat, bg_v, alpha); >+ aResult = bg_v < fg_v ? 1 : 0; NS_GetLuminosity() provides a better indication of lightness or darkness than V = max(R,G,B) and is cheaper to compute, uses saner types, and involves fewer parameters than NS_RGB2HSV, so please use that, assuming there is not a compelling reason to use V.
Assignee | ||
Comment 7•5 years ago
|
||
OK, thanks.
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/133509097b7c [css-mediaqueries] Synthesize a value for eIntID_SystemUsesDarkTheme to determine if GTK are using a light or dark theme. r=heycam,karlt
Comment 9•5 years ago
|
||
Backed out for dt failures on browser_webconsole_sidebar_scroll.js
Backout link: https://hg.mozilla.org/integration/mozilla-inbound/rev/659c7fae6ae49dc00e950a6755b7f724bcb9084e
Push link:https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&resultStatus=testfailed%2Cbusted%2Cexception%2Crunnable&selectedJob=229063893&revision=e919946fd91306287e4a6197c52a77b6361676ce
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=229063893&repo=mozilla-inbound&lineNumber=4268
Comment 10•5 years ago
|
||
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/738bb0805a9c [css-mediaqueries] Synthesize a value for eIntID_SystemUsesDarkTheme to determine if GTK are using a light or dark theme. r=heycam,karlt
Comment 11•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Description
•