Closed Bug 1644261 Opened 4 years ago Closed 4 years ago

Make macOS system CSS colors work for dark mode, if "force aqua" is off

Categories

(Core :: Widget: Cocoa, enhancement, P2)

All
macOS
enhancement

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

(Whiteboard: [mac:darkmode])

Attachments

(2 files)

At the moment, our CSS system colors on macOS always simulate "light mode", even when the system-wide Dark Mode is used.

When we set NSRequiresAquaSystemAppearance to NO (see bug 1623684), and the system-wide Dark Mode is enabled, some of the system colors change to be appropriate for dark mode. However, they do so inconsistently, and the -moz-appearance rendering for many widget types does not consistently update with them.

In this bug I'd like to investigate how we can fix this properly. It seems like having all -moz-appearance widgets and all relevant CSS system colors respect Dark Mode properly should be the right solution.
However, Firefox also has its own dark theme that can be toggled independently from the system-wide dark theme. How do these two themes interact? Does the Firefox dark theme not make use of any system colors? What about -moz-appearance? How does this work on Windows? How should it work?

Dão, ntim, I'm interested in your thoughts on this.

Flags: needinfo?(ntim.bugs)
Flags: needinfo?(dao+bmo)

Sounds good in principle to me, since in the default situation the Firefox theme follows the system theme. We already do this type of adjustment for a few things (can’t remember what atm, my memory is still a bit fuzzy, but I’ll let you know once I remember). If possible a pref would be convenient, but if not I think we can try this for a while.

Flags: needinfo?(ntim.bugs)

Thanks for the feedback!

(In reply to Markus Stange [:mstange] from comment #0)

In this bug I'd like to investigate how we can fix this properly. It seems like having all -moz-appearance widgets and all relevant CSS system colors respect Dark Mode properly should be the right solution.

Yeah, that would make sense. This already works on Linux because there's no dark mode switch, instead we just detect the Gtk theme being a dark one.

However, Firefox also has its own dark theme that can be toggled independently from the system-wide dark theme. How do these two themes interact? Does the Firefox dark theme not make use of any system colors? What about -moz-appearance?

Our dark theme adjustments avoid system colors and appearances, but there are some things that it doesn't adjust, so system stuff being dark would complement our support for dark mode.

How does this work on Windows? How should it work?

Windows behaves pretty much like macOS at the moment. Afaik this is because some legacy native applications make bogus assumptions about the system theme, although this should theoretically be less of a problem on Windows since it already provided dark high contrast themes that automatically affect system colors and appearances.

Blocks: 1475520
Flags: needinfo?(dao+bmo)
Blocks: 1641252
Blocks: 1623686
Severity: -- → S2
Priority: -- → P2
Whiteboard: [mac:darkmode]
Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED

I looked at this again and determined that, with "force aqua" off, the CSS colors already react in exactly the way we want, i.e. like on Linux. The only missing piece here was reacting to dynamic changes. The attached patch fixes that.
Landing this patch won't make an observable difference until we stop forcing aqua, bug 1623686.

Summary: Make macOS system CSS colors work for dark mode → Make macOS system CSS colors work for dark mode, if "force aqua" is off
Attachment #9207941 - Attachment description: Bug 1644261 - Make system colors update when the system theme changes, if widget.respect-system-appearance is set to true. r=emilio → Bug 1644261 - Make system colors update when the system theme changes, if widget.macos.respect-system-appearance is set to true. r=emilio

(In reply to steve-_- from comment #5)

Does this bug cover the download dialog? if not, should I file a separate bug?

I've filed bug 1697703 about the download dialog.

Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/bb1046829529 Make system colors update when the system theme changes, if widget.macos.respect-system-appearance is set to true. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: