Add -moz-dark-theme selector and associated preference and update prefers-color-scheme support to follow it #1784

Closed
opened 1 year ago by Ghost · 0 comments
Ghost commented 1 year ago

We want to support a dark theme mode since that seems to be a hotly requested feature both for the Default Theme and for various add-on themes. No surprise since the alternative in current operating systems seems to increasingly be stark white. Of course, adding this media feature and actually getting the styling in classic/1.0 for applications and toolkit are two very different things and will be one heck of a job in its self.

This will involve added the selector -moz-dark-theme and the associated int pref ui.color_scheme.

This preference will initially have the following states:

  • 0: Feature disabled
  • 1: Light - -moz-dark-theme is false (Default)
  • 2: Dark - -moz-dark-theme is true

Additionally, an int 3 would be "Follow System Scheme" if we ever decide to add that on supported operating systems that shall almost certainly be only Windows.

One additional Windows caveat is that the media feature should return false if a High Contrast Theme is in use. I think nsUXThemeData::IsHighContrastOn() would be the way to check this. #ifdef XP_WIN, of course.

We also want prefers-color-scheme to be able to follow ui.color_scheme so the logic for that would need the addition of an int 3. Applications will eventually need appropriate UI bits though I don't see a pressing reason at this time to bother. If ui.color_scheme is 0 then prefers-color-scheme should return true for light.

We want to support a dark theme mode since that seems to be a hotly requested feature both for the Default Theme and for various add-on themes. No surprise since the alternative in current operating systems seems to increasingly be stark white. Of course, adding this media feature and actually getting the styling in `classic/1.0` for applications and `toolkit` are two very different things and will be one heck of a job in its self. This will involve added the selector `-moz-dark-theme` and the associated int pref `ui.color_scheme`. This preference will initially have the following states: - 0: Feature disabled - 1: Light - `-moz-dark-theme` is false (Default) - 2: Dark - `-moz-dark-theme` is true Additionally, an int 3 would be "Follow System Scheme" if we ever decide to add that on supported operating systems that shall almost certainly be only `Windows`. One additional Windows caveat is that the media feature should return false if a High Contrast Theme is in use. I think `nsUXThemeData::IsHighContrastOn()` would be the way to check this. `#ifdef XP_WIN`, of course. We also want `prefers-color-scheme` to be able to follow `ui.color_scheme` so the logic for that would need the addition of an int 3. Applications will eventually need appropriate UI bits though I don't see a pressing reason at this time to bother. If `ui.color_scheme` is 0 then `prefers-color-scheme` should return true for `light`.
Ghost added the
Layout - CSS
label 1 year ago
Ghost changed title from Add -moz-dark-theme selector and associated preference and update to prefers-color-scheme support to follow it to Add -moz-dark-theme selector and associated preference and update prefers-color-scheme support to follow it 1 year ago
athenian200 was assigned by Ghost 1 year ago
Ghost added this to the 29.3.0 milestone 1 year ago
Ghost added the
Fixed
label 1 year ago
Ghost closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: MoonchildProductions/UXP#1784
Loading…
There is no content yet.