mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-15 01:31:30 -07:00
Improve querying of app theme preference
This commit is contained in:
parent
83e3c487a9
commit
6e8faff624
@ -9,15 +9,10 @@ namespace Bloxstrap.Extensions
|
||||
if (dialogTheme != Theme.Default)
|
||||
return dialogTheme;
|
||||
|
||||
RegistryKey? key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
using var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
|
||||
if (key is not null)
|
||||
{
|
||||
var value = key.GetValue("AppsUseLightTheme");
|
||||
|
||||
if (value is not null && (int)value == 0)
|
||||
return Theme.Dark;
|
||||
}
|
||||
if (key?.GetValue("AppsUseLightTheme") is int value && value == 0)
|
||||
return Theme.Dark;
|
||||
|
||||
return Theme.Light;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user