Mercurial > minori
comparison src/sys/win32/dark_theme.cpp @ 1:1ae666fdf9e2
*: initial commit
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Tue, 08 Aug 2023 19:49:15 -0400 |
| parents | |
| children | 23d0d9319a00 |
comparison
equal
deleted
inserted
replaced
| 0:5a76e1b94163 | 1:1ae666fdf9e2 |
|---|---|
| 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 } |
