Closed Bug 1736141 Opened 3 years ago Closed 3 years ago

prefers-color-scheme should not default to dark for Elemental Balanced

Categories

(Firefox :: Theme, defect)

defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- unaffected
firefox93 --- unaffected
firefox94 --- unaffected
firefox95 --- fixed

People

(Reporter: birtles, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

I'm using the Elemental Balanced theme which has a light new tab page but mostly dark chrome.

Bug 1529323 causes prefers-color-scheme to default to dark which is surprising to me as I would expect it to follow what the new tab page does.

Hi Emilio, needinfo'ing you as requested in bug 1529323 comment 55. Thanks!

Flags: needinfo?(emilio)

Yeah, so I'd argue this is a bug (or inconsistency) in the theme code. We derive the preferred color scheme from the toolbar background color (which in this theme is dark).

This inconsistency was already present before my patch. The newtab page is light-ish, but all the other bits of the browser chrome like about:addons, about:preferences, etc were dark.

We could split the preference for content in two using the newtab page colors I guess, let me check how hard would it be.

Component: CSS Parsing and Computation → Theme
Product: Core → Firefox
Assignee: nobody → emilio
Flags: needinfo?(emilio)

Document::GetBrowsingContext uses a WeakPtr<nsIDocShell> so we can't do
that. But we have all the other media emulation data and so on in the
pres context which we can access off the main thread for style, so move the
override code there.

We use "is-in-chrome-docshell" rather than "is a chrome doc" so that about:
pages that are loaded in the content area (like about:addons etc) follow the
general content theme as well.

Cache the relevant color schemes since having that many branches on the default
system theme made me a bit uncomfortable, and this code can be called quite a
lot... Though it probably isn't such a huge deal.

Depends on D128673

The toolbar pref change triggers eventually a look-and-feel-changed
notification, so no need to observe that directly.

Depends on D128674

Thanks! Distinguishing between dark mode for chrome vs content makes a lot more sense to me.

Blocks: 1736218

Set release status flags based on info from the regressing bug 1529323

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/affb20d60222 Make Document::PreferredColorScheme safe to call off-main-thread. r=mstange
Keywords: leave-open
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/59c6e74da9db Remove unneeded observer in devtools theme code. r=jdescottes
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/63dee7b57626 Derive a content theme from newtab page background, and use it for non-chrome docshells. r=mstange,dao
Keywords: leave-open
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
Regressions: 1741900
Has Regression Range: --- → yes
Regressions: 1725917
Regressions: 1756082
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: