In Firefox, I want to have both browser.in-content.dark-mode and privacy.resistFingerprinting set to true. However, the latter setting, as discussed in this issue, masks this setting and sets the preferred color scheme (prefers-color-scheme) to light. How do I force prefers-color-scheme to be dark?
- 159
2 Answers
As a comment on the other answer mentions, the "Dark Website Forcer" extension can't solve this problem, nor does there seem to be any other way to override privacy.resistFingerprinting's forced light mode. It's hardcoded in C++.
But recent versions of Firefox have introduced a new, strangely similar mode controlled by privacy.fingerprintingProtection, which does allow this to be overridden. Here are the about:config settings you need, in user.js format (you can also enter them manually in about:config):
// resistFingerprinting overrides fingerprintingProtection, so these must be disabled
user_pref("privacy.resistFingerprinting", false);
user_pref("privacy.resistFingerprinting.pbmode", false);
// At least one of these two must be enabled
user_pref("privacy.fingerprintingProtection", true);
user_pref("privacy.fingerprintingProtection.pbmode", true);
user_pref("privacy.fingerprintingProtection.overrides", "+AllTargets,-CSSPrefersColorScheme");
You can add ,-JSDateTimeUTC to the overrides to prevent forcing the time zone to UTC, which is the other most frequent complaint about resistFingerprinting. The full list of controllable options is in RFPTargets.inc.
This mode seems to still be undocumented as I write this, and I don't know the first Firefox version in which this will work properly—perhaps 118ish.
115 ESR has this mode but only in a half-baked form. +AllTargets doesn't work, and it seems to be necessary to enable every "target" individually. The list of targets is shorter as well. Here's code to enable them except for CSSPrefersColorScheme:
user_pref("privacy.fingerprintingProtection.overrides", "-CSSPrefersColorScheme,+TouchEvents,+PointerEvents,+KeyboardEvents,+ScreenOrientation,+SpeechSynthesis,+CSSPrefersReducedMotion,+CSSPrefersContrast,+CanvasRandomization,+CanvasImageExtractionPrompt,+CanvasExtractionFromThirdPartiesIsBlocked,+CanvasExtractionBeforeUserInputIsBlocked,+NavigatorAppName,+NavigatorAppVersion,+NavigatorBuildID,+NavigatorHWConcurrency,+NavigatorOscpu,+NavigatorPlatform,+NavigatorUserAgent,+StreamTrackLabel,+StreamVideoFacingMode");
user_pref("general.useragent.override", "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0");
The second line is because +NavigatorUserAgent doesn't seem to actually work, and I wouldn't be surprised if some of the others don't work either, but coveryourtracks.eff.org gives it a reasonably good bill of health.
I assume that not too long from now this mode will be documented and safer than now as a replacement for resistFingerprinting.
- 866
At the issue discusses, the browser theme is set to light in order to increase privacy and make fingerprinting you harder. Overriding this preference will reduce privacy marginally but save your eyes. Without installing a whole dark theme (e.g., Dark Reader), which in my experience can cause a little bit of lag and a less appealing color scheme (compared to what would be shown with prefers-color-scheme="dark", you can override prefers-color-scheme. There is an extension that does just that called Dark Website Forcer.
Alternatively, for extra credit, you can always modify the appropriate source code of firefox, such as Document.cpp to uses the Dark preference when ShouldResistFingerprinting is true. Other defaults to Light should also be overridden. Then you'll have to build. The extension is obviously the easier way to go and just as effective. This will be the case until the aforementioned issue is resolved.
- 159