Important: Please read the Qt Code of Conduct -

Windows 10 Dark Theme

  • Does Qt support the dark theme for Windows 10? It does on Mac OS and the preview in QtCreator on Windows is displayed using the system colors, but the compiled application displayed using the default or light theme.

  • Lifetime Qt Champion

    Hi and welcome to the forums.
    There is no official dark theme for compiled Qt apps.
    However, this is pretty nice.

    However, its based on stylesheets.

  • Thank you, this answers my question and helps!

  • After trying the links above and a bit of Googling, the solution I ended up using was using QPalettes. This is very similar to the palettes used by Jorken-VikingGod in the link above. The advantage of this over the style sheets is that it it seemed to affect the layout of controls less since it uses the same controls. In case this is useful for anyone else, this code only uses the dark theme if compiling for Windows and the user is using the dark theme. If the user changes the theme while the program is running it does not change back to light, but this is still suitable for my needs. I just added the following to the main() function before showing the main window.

    #ifdef Q_OS_WIN
        QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",QSettings::NativeFormat);
            QPalette darkPalette;
            QColor darkColor = QColor(45,45,45);
            QColor disabledColor = QColor(127,127,127);
            darkPalette.setColor(QPalette::Window, darkColor);
            darkPalette.setColor(QPalette::WindowText, Qt::white);
            darkPalette.setColor(QPalette::Base, QColor(18,18,18));
            darkPalette.setColor(QPalette::AlternateBase, darkColor);
            darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
            darkPalette.setColor(QPalette::ToolTipText, Qt::white);
            darkPalette.setColor(QPalette::Text, Qt::white);
            darkPalette.setColor(QPalette::Disabled, QPalette::Text, disabledColor);
            darkPalette.setColor(QPalette::Button, darkColor);
            darkPalette.setColor(QPalette::ButtonText, Qt::white);
            darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, disabledColor);
            darkPalette.setColor(QPalette::BrightText, Qt::red);
            darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
            darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
            darkPalette.setColor(QPalette::HighlightedText, Qt::black);
            darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, disabledColor);
            qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");

    I also had to add #include <QStyleFactory> to main.cpp

  • @Carl_P, this is a great solution and really does work like charm, thanks for sharing! I couldn't find any missing bits that most of the dark stylesheets have.
    The only nitpick I have is that the "Fusion" style doesn't really have the native look and feel. This was enough for me to refuse using this solution, but I love how concise and simple it is. Shame Qt still doesn't support the dark theme natively.

  • @Carl_P

    Do you see any reason why the same build on the same qtlibs would have this dark theme working on some win10 and on some win10 it is still unchanged?

  • I just stumbled upon this, after successfully having adapted one of my projects to look good in dark mode on Linux/KDE and macOS. Is there anything new about this? Will Qt support Windows's dark mode, as it does on Linux and macOS without having to implement it manually?

  • @Seb-Tur I don't know exactly. I think the thing I would look at is whether the AppsUseLightTheme setting is located in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize in the version where the dark mode is not working. This can be found in regedit.msc

  • @l3u_ I think there may be some support for dark mode in Qt 5.15 or at least it may be coming. In the QGuiApplication documentation, there are platform specific command line options, this one looks promising:

    darkmode=[1|2] controls how Qt responds to the activation of the Dark Mode for applications introduced in Windows 10 1903 (since Qt 5.15).
    A value of 1 causes Qt to switch the window borders to black when Dark Mode for applications is activated and no High Contrast Theme is in use. This is intended for applications that implement their own theming.

    A value of 2 will in addition cause the Windows Vista style to be deactivated and switch to the Windows style using a simplified palette in dark mode. This is currently experimental pending the introduction of new style that properly adapts to dark mode.

  • @Carl_P
    not present

  • @Seb-Tur Early versions of Windows 10 did not have dark mode, if I recall correctly. I think this came with one of the later updates. If you add this field in regedit, it will work.

  • @Carl_P 's solution combined with Qtimer it'll follows windows 10 mode changes immediately . Here is an example

  • This post is deleted!

  • Using Carl_P's solution works well for my application (Win10) on everything but QWizard and QWizardPage, how do I go about setting the colors on those as well?

  • This post is deleted!

Log in to reply