9
|
1 #include "sys/win32/dark_theme.h"
|
2
|
2 #include <QOperatingSystemVersion>
|
9
|
3 #include <QSettings>
|
|
4
|
|
5 namespace win32 {
|
|
6
|
|
7 bool DarkThemeAvailable() {
|
|
8 // dark mode supported Windows 10 1809 10.0.17763 onward
|
|
9 // https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi
|
|
10 if (QOperatingSystemVersion::current().majorVersion() == 10) {
|
|
11 return QOperatingSystemVersion::current().microVersion() >= 17763;
|
|
12 } else if (QOperatingSystemVersion::current().majorVersion() > 10) {
|
|
13 return true;
|
|
14 } else {
|
|
15 return false;
|
|
16 }
|
2
|
17 }
|
|
18
|
9
|
19 bool IsInDarkTheme() {
|
|
20 QSettings settings("HKEY_CURRENT_"
|
|
21 "USER\\Software\\Microsoft\\Windows\\CurrentVersion\\The"
|
|
22 "mes\\Personalize",
|
|
23 QSettings::NativeFormat);
|
|
24 return settings.value("AppsUseLightTheme", 1).toInt() == 0;
|
2
|
25 }
|
9
|
26
|
|
27 } // namespace win32
|