mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-29 14:26:20 +00:00
for wpf follow sytemtheme
This commit is contained in:
parent
5f5bd7ec6a
commit
f6e82bb81b
1 changed files with 19 additions and 11 deletions
|
@ -1712,20 +1712,28 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public void ModifyTheme(out bool isDarkTheme)
|
||||
{
|
||||
var currentTheme = SystemParameters.HighContrast ? Theme.Dark : Theme.Light;
|
||||
isDarkTheme = currentTheme == Theme.Dark;
|
||||
|
||||
var window = Application.Current.MainWindow;
|
||||
var windowChrome = WindowChrome.GetWindowChrome(window);
|
||||
|
||||
ThemeManager.Current.ChangeTheme(window, new Theme(isDarkTheme ? Theme.Dark : Theme.Light));
|
||||
windowChrome.CaptionHeight = isDarkTheme ? 0 : 32;
|
||||
windowChrome.CornerRadius = new CornerRadius(isDarkTheme ? 0 : 8);
|
||||
|
||||
var theme = _paletteHelper.GetTheme();
|
||||
theme.SetBaseTheme(isDarkTheme ? Theme.Dark : Theme.Light);
|
||||
_paletteHelper.SetTheme(theme);
|
||||
|
||||
Utils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
|
||||
}
|
||||
|
||||
public void ModifyTheme(bool isDarkTheme)
|
||||
{
|
||||
var theme = _paletteHelper.GetTheme();
|
||||
//add follow systemTheme
|
||||
var systemTheme = Windows.UI.Xaml.Application.Current.RequestedTheme;
|
||||
if (systemTheme == ApplicationTheme.Dark)
|
||||
{
|
||||
isDarkTheme = true;
|
||||
}
|
||||
else if (systemTheme == ApplicationTheme.Light)
|
||||
{
|
||||
isDarkTheme = false;
|
||||
}
|
||||
|
||||
theme.SetBaseTheme(isDarkTheme ? Theme.Dark : Theme.Light);
|
||||
_paletteHelper.SetTheme(theme);
|
||||
|
||||
|
|
Loading…
Reference in a new issue