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