mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-16 02:01:29 -07:00
21 lines
548 B
C#
21 lines
548 B
C#
using Microsoft.Win32;
|
|
|
|
namespace Bloxstrap.Extensions
|
|
{
|
|
public static class ThemeEx
|
|
{
|
|
public static Theme GetFinal(this Theme dialogTheme)
|
|
{
|
|
if (dialogTheme != Theme.Default)
|
|
return dialogTheme;
|
|
|
|
using var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
|
|
|
if (key?.GetValue("AppsUseLightTheme") is int value && value == 0)
|
|
return Theme.Dark;
|
|
|
|
return Theme.Light;
|
|
}
|
|
}
|
|
}
|