Closed Bug 1720508 Opened 3 years ago Closed 3 years ago

Ability to override prefers-color-scheme for web pages only

Categories

(Core :: Widget: Gtk, defect)

Firefox 90
defect

Tracking

()

RESOLVED DUPLICATE of bug 1707872
Tracking Status
firefox-esr78 --- unaffected
firefox90 --- affected
firefox91 --- fixed
firefox92 --- fixed

People

(Reporter: bernat, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Attached image 2021-07-14_17-57.png

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

On Linux:

  1. Use a GTK dark theme.
  2. Use "Dark" as Firefox theme
  3. Set ui.systemUsesDarkTheme to 0

Actual results:

  1. Web pages are not using the dark theme (good)
  2. Firefox interface mixes light and dark theme (not good)

Popup menus are white. Save dialog box is using a light theme, but some items are rendered as dark.

Expected results:

  1. Web pages are not using the dark theme
  2. Firefox is using the dark theme

I realize that I am lying by setting ui.systemUseDarkTheme to 0. Up to Firefox 89, this was providing the expected result. I want to use a dark interface but I want the pages to be rendered as "light". Alternatively, there should be a dedicated setting to set prefers-color-scheme for web sites.

The Bugbug bot thinks this bug should belong to the 'Firefox::Theme' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Theme

This is definitely not the right approach, but using this patch, I get what I want: dark theme for interface, light theme for web pages. I can put a new preference settings for that if it would be accepted.

--- firefox-90.0.orig/dom/base/Document.cpp
+++ firefox-90.0/dom/base/Document.cpp
@@ -17160,7 +17160,7 @@ StylePrefersColorScheme Document::Prefer

   const bool dark =
       !!LookAndFeel::GetInt(LookAndFeel::IntID::SystemUsesDarkTheme, 0);
-  return dark ? StylePrefersColorScheme::Dark : StylePrefersColorScheme::Light;
+  return StylePrefersColorScheme::Light;
 }

 // static

Also, see 1547818. I'd rather prefer a preference in about:config, but I would also accept a web extension.

I could reproduce the issue in Firefox 90 under Ubuntu 18.04 64-bit.
However, this is already fixed in Firefox 91 beta 2 and latest Nightly 92.0a1.
Can you please give it a try? Thank you!

Flags: needinfo?(bernat)

Hey!

Yes, it works just fine in Firefox 91 beta 2.

Thanks!

Flags: needinfo?(bernat)

I checked with mozregression and found out that this bug was regressed by bug 1707957 in 90 and fixed by bug 1707872 in 91 (which will most probably ride the trains).

Severity: -- → S3
Component: Theme → Widget: Gtk
Depends on: 1707872
Keywords: regression
Product: Firefox → Core
Regressed by: 1707957
Has Regression Range: --- → yes
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
See Also: → 1722886
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: