add auto darkmode

This commit is contained in:
Tsuki 2023-04-01 20:32:53 +08:00
parent 5bef6b0492
commit 881d694f77

View file

@ -1716,11 +1716,18 @@ namespace v2rayN.ViewModels
{ {
var theme = _paletteHelper.GetTheme(); var theme = _paletteHelper.GetTheme();
//add follow systemTheme //add follow systemTheme
var systemTheme = App.Current.RequestedTheme; var systemTheme = OSAppTheme.Light;
if (systemTheme == AppTheme.Dark){ 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; isDarkTheme = true;
} }
else if (systemTheme == AppTheme.Light){ else if (systemTheme == OSAppTheme.Light){
isDarkTheme = false; isDarkTheme = false;
} }