Skip to content

Commit

Permalink
Windows: Set proper window title bar color
Browse files Browse the repository at this point in the history
Set proper window title bar color based on dark/light theme on Windows 10+ and Qt 5.15+
  • Loading branch information
rodlie committed Apr 18, 2024
1 parent 6e28f2a commit 688f45e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions App/NatronApp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ int main(int argc, char *argv[])
freopen("CONOUT$", "w", stderr);
}
}
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
// Set proper window title bar color (https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5)
QSettings registry(QString::fromUtf8("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"),
QSettings::NativeFormat);
if (registry.value(QString::fromUtf8("AppsUseLightTheme"), 0).toInt() == 0) {
qputenv("QT_QPA_PLATFORM", "windows:darkmode=1");
}
#endif
#endif

#if defined(Q_OS_UNIX) && defined(RLIMIT_NOFILE)
Expand Down

0 comments on commit 688f45e

Please sign in to comment.