Open Bug 1591679 Opened 6 years ago Updated 4 months ago

Add an option to auto-darken web pages that don't have a dark color-scheme

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: volpedifuoco, Unassigned, Mentored)

References

(Depends on 1 open bug)

Details

(Keywords: parity-chrome)

Attachments

(4 files)

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

Steps to reproduce:

Why/User Benefit/User Problem

As a user, I want my browser to be able to force websites content to use dark mode, so I can have control over how my browser in customized to match my preferences.

What / Requirements

  • There exists a setting that forces web content to use a dark theme
  • There exists an easily accessible escape hatch to get out of the forced dark theme if the website breaks

Acceptance Criteria (how do I know when I’m done?)

  • I can choose to view website content in dark mode.
  • I don't see a flash of white/light colors before the dark theme is applied.
  • I can interact with the sites when the dark theme is force applied.

We avoid cases where we use dark foreground and background colors. For example testing forms is a common source of problems.

Same feature request on the Firefox Preview Github page: https://github.com/mozilla-mobile/fenix/issues/2139

Essentially, it is the same feature introduced recently in Chromium stable channel (chrome://flags/#enable-force-dark), on both desktop and mobile.

Component: Untriaged → General

Emilio, any idea where this should be tracked? Does it require layout specific support?

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(emilio)
Keywords: parity-chrome

So there's a devtools setting to allow emulating prefers-color-scheme: dark which already landed (bug 1550804).

I don't think we render form controls differently based on prefers-color-scheme, so that should be all that's needed until we make that change, if we do that at all, right? Or am I misunderstanding?

Flags: needinfo?(emilio)

Oh, I missed what the Chrome flag did (because apparently it needed a restart). So this is about auto-darkening web content, by filtering colors and inverting presumably?

That sounds a bit of a different thing, and yeah, that'll most likely need layout engine support (https://drafts.csswg.org/css-color-adjust/ is where some of these proposals are).

Depends on: css-color-adjust-1
Depends on: 1794320
Depends on: 1794482
Depends on: 1794484
Severity: normal → S3
Depends on: 1801520
Depends on: 1806948

What's the status of this bug as of now? All its dependencies seem to have been resolved, but there's no visible movement.

It would be pretty great to have parity with Chromium, where you can just flip a toggle for glorious, and yet performant, dark mode everywhere. Extension use is a nice workaround, but there's a bit of an arms race there where they sometimes need to catch up to website changes.

Flags: needinfo?(mcheang)
Component: General → Layout
Flags: needinfo?(mcheang)
Product: Firefox → Core

Moving this for core layout, they will have a better response. Thank you.

(In reply to zesanup from comment #4)

What's the status of this bug as of now?

I don't think any progress has been made. (Also: I'll adjust the bug title to clarify what the actual request is here.)

All its dependencies seem to have been resolved, but there's no visible movement.

The bugs that are marked as dependencies don't actually seem to have been about the feature being requested here, and they all seem to have been resolved for reasons unrelated to patches having been landed in Firefox.

It would be pretty great to have parity with Chromium, where you can just flip a toggle for glorious, and yet performant, dark mode everywhere. Extension use is a nice workaround, but there's a bit of an arms race there where they sometimes need to catch up to website changes.

Agreed, it would be great! The layout folks are a small team juggling lots of competing priorities, though, and there are other projects that are likely to remain higher priority than this for the forseeable future. For now, the "Dark Reader" extension is probably your best bet.

Summary: Force web content to use dark mode → Add an option to auto-darken web pages that don't have a dark color-scheme
Attached file testcase 1

Just to prod a bit at what Chrome's chrome://flags/#enable-force-dark feature actually does -- it seems to have no effect if the page declares color-scheme: dark (in which case Chrome hands off darkening responsibility to the page itself). Here's a testcase to illustrate that, where there's a declared color-scheme: dark with an explicitly-white background which Chrome does not darken.

(This behavior makes sense, I think; just posting the testcase for the benefit of folks potentially working on this in the future and wondering about edge cases like this.)

Awesome. Thanks for all the details! Currently I use Dark Background Light Text as Dark Reader tends to slow the browser more. There's also Bug 1848474, but I haven't checked whether it's still an issue. I'll do that.

I think a good first step here would be to figure out what the effect of this flag really is in other browsers. Is it done at the CSS color level, or at the graphics level (using filter() and so on)?

I'd be happy to mentor an implementation of this if someone is interested. But definitely not a security bug tho :)

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: