Skip to content

Commit

Permalink
Check high contrast theme for auto dark mode on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin committed Jan 25, 2025
1 parent 4162e0e commit 5e60197
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Telegram/SourceFiles/platform/win/specific_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 5e60197

Please sign in to comment.