Simplify and improve Darkmode

This commit is contained in:
Tsuki 2023-04-01 21:22:25 +08:00
parent f6e82bb81b
commit c1c4d8752c

View file

@ -1714,8 +1714,11 @@ namespace v2rayN.ViewModels
public void ModifyTheme(out bool isDarkTheme)
{
var currentTheme = SystemParameters.HighContrast ? Theme.Dark : Theme.Light;
isDarkTheme = currentTheme == Theme.Dark;
var currentTheme = Application.Current.Resources.MergedDictionaries
.OfType<Theme>()
.FirstOrDefault()?
.BaseColorScheme == ThemeManager.BaseColorScheme.Dark;
isDarkTheme = currentTheme.HasValue && currentTheme.Value;
var window = Application.Current.MainWindow;
var windowChrome = WindowChrome.GetWindowChrome(window);