Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84484

Add settings for Chromium's dark mode

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Fixed
    • P4: Low
    • 6.7.0 FF
    • None
    • WebEngine
    • None
    • bd8572420 (dev)

    Description

      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:

      --blink-settings=forceDarkModeEnabled=true  // Current Chromium
      --blink-settings=darkModeEnabled=true  // Qt 5.15
      --blink-settings=darkMode=4  // Qt 5.14
      

      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:

      Attachments

        1. image-2020-05-27-16-45-30-543.png
          73 kB
          Florian Bruhin
        2. image-2020-05-27-16-53-50-286.png
          71 kB
          Florian Bruhin
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            the compiler Florian Bruhin
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes