mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-30 10:19:51 +08:00
22 lines
612 B
C#
22 lines
612 B
C#
using Microsoft.Win32;
|
|
|
|
namespace MicaSetup.Design.Controls;
|
|
|
|
public static class WindowsThemeHelper
|
|
{
|
|
public static WindowsTheme GetCurrentWindowsTheme()
|
|
{
|
|
using RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
|
object? registryValueObject = key?.GetValue("AppsUseLightTheme");
|
|
|
|
if (registryValueObject == null)
|
|
{
|
|
return WindowsTheme.Light;
|
|
}
|
|
|
|
var registryValue = (int)registryValueObject;
|
|
|
|
return registryValue > 0 ? WindowsTheme.Light : WindowsTheme.Dark;
|
|
}
|
|
}
|