Skip to content

Commit

Permalink
enable dark theme (web-eid#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
antirais authored Oct 2, 2023
1 parent 2725dd1 commit 49f62a3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/controller/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ bool Application::isDarkTheme()
"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
QSettings::NativeFormat);
return settings.value("AppsUseLightTheme", 1).toInt() == 0;
#elif 0 // Disabled as there is currently no straightforward way to detect dark mode in Linux.
#else
// There is currently no straightforward way to detect dark mode in Linux, but this works for supported OS-s.
static const bool isDarkTheme = [] {
QProcess p;
p.start(QStringLiteral("gsettings"), {"get", "org.gnome.desktop.interface", "gtk-theme"});
p.start(QStringLiteral("gsettings"), {"get", "org.gnome.desktop.interface", "color-scheme"});
if (p.waitForFinished()) {
return p.readAllStandardOutput().contains("dark");
}
Expand All @@ -94,8 +95,6 @@ bool Application::isDarkTheme()
return text_hsv_value > bg_hsv_value;
}();
return isDarkTheme;
#else
return false;
#endif
}
#endif
Expand Down

0 comments on commit 49f62a3

Please sign in to comment.