From c1c4d8752c7362fb9f141f6b04a54dabbc0b2fb6 Mon Sep 17 00:00:00 2001 From: Tsuki Date: Sat, 1 Apr 2023 21:22:25 +0800 Subject: [PATCH] Simplify and improve Darkmode --- v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 263e8b56..a7006a7d 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -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() + .FirstOrDefault()? + .BaseColorScheme == ThemeManager.BaseColorScheme.Dark; + isDarkTheme = currentTheme.HasValue && currentTheme.Value; var window = Application.Current.MainWindow; var windowChrome = WindowChrome.GetWindowChrome(window);