improve styling in relation to windows theme

This commit is contained in:
2025-05-10 06:44:58 +01:00
parent 8d7a0d12b9
commit 7745bba10e
4 changed files with 41 additions and 4 deletions
+14
View File
@@ -83,3 +83,17 @@ pub fn is_elevated() -> bool {
result.is_ok() && elevation.TokenIsElevated != 0
}
}
pub fn is_system_theme_dark() -> bool {
use winreg::RegKey;
let hkcu = RegKey::predef(winreg::enums::HKEY_CURRENT_USER);
let Ok(subkey) =
hkcu.open_subkey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")
else {
return true;
};
let Ok(dword): Result<u32, std::io::Error> = subkey.get_value("AppsUseLightTheme") else {
return true;
};
dword != 1
}