Since Qt 5.14, the underlying Chromium makes it possible to force "dark mode" for websites. Doing so filters websites so that they appear dark, even if the websites themselves don't offer a dark style:
This can be set in chrome://flags in Chromium, or by using one of the following command lines, which also work for QtWebEngine:
However, since those are commandline arguments, changing them (notably, disabling dark mode) requires a restart of the application. It would be amazing if this was settable at runtime instead (at the very least, allowing to enable/disable it at runtime) so that it could e.g. be turned off for websites where it is problematic in some way.
There are various related Blink settings, some more documentation about them and their impact can be found in my adoption of them for qutebrowser. I guess the question is what to expose - I can see a couple of different approaches:
- Expose all 9 setting individually via QWebEngineSettings
- Only expose a way to turn it on/off, allowing to set the rest via commandline arguments
- Instead of exposing dark mode specifically, expose a way to set Blink settings as runtime from a key/value mapping of strings. This would be a more generic solution (also allowing to set other Blink settings at runtime), but might be too low-level for an API.
- Expose the "variants" Chromium displays in chrome://flags: