comparison src/sys/win32/dark_theme.cc @ 81:9b2b41f83a5e

boring: mass rename to cc because this is a very unix-y project, it makes more sense to use the 'cc' extension
author Paper <mrpapersonic@gmail.com>
date Mon, 23 Oct 2023 12:07:27 -0400
parents src/sys/win32/dark_theme.cpp@6481c5aed3e1
children 6d8da6e64d61
comparison
equal deleted inserted replaced
80:825506f0e221 81:9b2b41f83a5e
1 #include "sys/win32/dark_theme.h"
2 #include <QOperatingSystemVersion>
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 const auto& ver = QOperatingSystemVersion::current();
11 return (ver.majorVersion() > 10) ? true : (ver.majorVersion() == 10 && ver.microVersion() >= 17763);
12 }
13
14 bool IsInDarkTheme() {
15 QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
16 QSettings::NativeFormat);
17 return settings.value("AppsUseLightTheme", 1).toInt() == 0;
18 }
19
20 } // namespace win32