bool ChangeTheme(bool a = true) { try { if (SettingHelper.ContainsKey("_Theme")) { var TitleBar = ApplicationView.GetForCurrentView().TitleBar; Color color = ColorRelated.GetColor(); Application.Current.Resources["bili_Theme"] = new SolidColorBrush(color); ChangeDarkMode(currentTheme); ChangeDarkMode(currentTheme); TitleBar.BackgroundColor = color; TitleBar.ButtonBackgroundColor = color; TitleBar.ForegroundColor = Colors.White; TitleBar.ButtonHoverForegroundColor = Colors.Black; TitleBar.ButtonHoverBackgroundColor = Colors.White; if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { StatusBar sb = StatusBar.GetForCurrentView(); sb.BackgroundColor = color; sb.BackgroundOpacity = 1; } } return(true); } catch { return(false); } }
public object Convert(object value, Type targetType, object parameter, string language) { var b = int.Parse(value.ToString()); SolidColorBrush brush = new SolidColorBrush(); brush.Color = b < 4 ? ColorRelated.GetColor() : SettingHelper.GetValue("_nighttheme").ToString() == "light" ? Colors.Black : Colors.White; return(brush); }
public object Convert(object value, Type targetType, object parameter, string language) { var b = (bool)value; SolidColorBrush brush = new SolidColorBrush(); if (b) { brush.Color = ColorRelated.GetColor(); return(brush); } else { return(Application.Current.Resources["SystemControlForegroundBaseHighBrush"]); } }
async void TopShoworHide() { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { StatusBar sb = StatusBar.GetForCurrentView(); if ((bool)SettingHelper.GetValue("_topbar") == false) { await sb.ShowAsync(); Color color = ColorRelated.GetColor(); sb.BackgroundColor = color; sb.BackgroundOpacity = 1; } else if ((bool)SettingHelper.GetValue("_topbar") == true) { await sb.HideAsync(); } } }