From 881d694f77545e3b596893fce8d96d61fff42e72 Mon Sep 17 00:00:00 2001 From: Tsuki Date: Sat, 1 Apr 2023 20:32:53 +0800 Subject: [PATCH] add auto darkmode --- v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 0f7a89ac..13324c49 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -1716,11 +1716,18 @@ namespace v2rayN.ViewModels { var theme = _paletteHelper.GetTheme(); //add follow systemTheme - var systemTheme = App.Current.RequestedTheme; - if (systemTheme == AppTheme.Dark){ + var systemTheme = OSAppTheme.Light; + if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile"){ + systemTheme = Application.Current.RequestedTheme; + } + else{ + systemTheme = Windows.UI.Xaml.Application.Current.RequestedTheme; + } + + if (systemTheme == OSAppTheme.Dark){ isDarkTheme = true; } - else if (systemTheme == AppTheme.Light){ + else if (systemTheme == OSAppTheme.Light){ isDarkTheme = false; }