Cimbali / toggle-dark-mode

A webextension to toggle the content’s color scheme between preferring light or dark, or inheriting
Do What The F*ck You Want To Public License
21 stars 0 forks source link

Any way to override Firefox's Resist Fingerprinting setting? #2

Open bhadaway opened 2 years ago

bhadaway commented 2 years ago

When Firefox's Resist Fingerprinting setting is on, it forces light mode.

It doesn't matter if you've set dark mode at the system, browser, site, or even inspect level, it seems to be impossible to enable dark mode while this setting is on.

I thought perhaps at the add-on layer, if I could overtly declare prefers-color-scheme (which led me to your add-on), that it might just work. Nope.

Perhaps there's a creative solution you could think of to override/workaround this problem with your add-on?

Cimbali commented 2 years ago

Hmm, that’s quite a tricky question. If you can’t do it at the inspect level, I’m not sure what can be done to be honest. Any change to the CSS or the CSS rendering would create an event and thus break the fingerprinting protection − so I get why they do it that way.

In any case this add-on’s approach is to try to be minimally invasive, so we don’t do anything on the pages themselves, we only toggle the preference. In practice, this means that if toggling the layout.css.prefers-color-scheme.content-override preference does nothing, then this add-on can not help you either I’m afraid.

bhadaway commented 2 years ago

No worries; I figured it was a long-shot.

At least it's on your radar now in case you have a lightbulb moment where you're updating the add-on and think of a clever way to work around this problem without doing anything invasive or bloated.

Cimbali commented 1 year ago

There’s the following note on the prefers-color-scheme page (in French can’t find it in English for some reason), here it is translated:

Note: If you changed privacy.resistFingerprinting to true, the prefers-color-scheme setting will be reset to light. Alternatively, you can create the numeric parameter ui.systemUsesDarkTheme to override the default behavior and return light (value: 0), dark (value: 1), or no-preference (value: 2). (Firefox will return light if another value is used.)

So not 100% sure what to make of this but maybe try playing with creating a ui.systemUsesDarkTheme preference?

bhadaway commented 1 year ago

No-go, resist fingerprinting still overrides it.

I have tried making a case for making dark mode the default though:

https://connect.mozilla.org/t5/ideas/for-fingerprinting-resistance-set-the-quot-prefers-color-scheme/idi-p/7132

FaridZelli commented 1 year ago

Thanks for posting, I really hope this goes through. Mozilla have been very strict about their pointless fingerprint resistance policies till now, forcing all of the options to be enabled or disabled at once. This is the opposite of giving users more control.

More than 80% of Android 10+ and iOS users prefer Dark Mode according to various statistics.