Check high contrast theme for auto dark mode on Windows

This commit is contained in:
Ilya Fedin 2025-01-25 21:48:35 +04:00 committed by John Preston
parent 8534cf3756
commit 5f5a2a3ef2

View file

@ -399,6 +399,13 @@ std::optional<bool> IsDarkMode() {
return std::nullopt;
}
HIGHCONTRAST hcf = {};
hcf.cbSize = static_cast<UINT>(sizeof(HIGHCONTRAST));
if (SystemParametersInfo(SPI_GETHIGHCONTRAST, hcf.cbSize, &hcf, FALSE)
&& (hcf.dwFlags & HCF_HIGHCONTRASTON)) {
return std::nullopt;
}
const auto keyName = L""
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
const auto valueName = L"AppsUseLightTheme";