public List <ThemeColorModel> GetAllColor() { var list = new List <ThemeColorModel>(); var colors = Application.Current.Resources["ThemeColors"] as ResourceDictionary; foreach (var item in colors) { var model = new ThemeColorModel(); model.Name = (string)item.Key; model.ThemeColor = (Color)item.Value; list.Add(model); } return(list); }
public void SetThemeColor(ThemeColorModel theme) { var currentBrush = GetCurrentThemeBrush(); Color targetColor = theme == null ? currentBrush.Color : theme.ThemeColor; _logService.Debug($"Try to set theme color to {targetColor.ToString()}"); currentBrush.Color = targetColor; var view = ApplicationView.GetForCurrentView(); view.TitleBar.ButtonBackgroundColor = Colors.Transparent; view.TitleBar.BackgroundColor = Colors.Transparent; view.TitleBar.InactiveBackgroundColor = Colors.Transparent; view.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; view.TitleBar.ButtonForegroundColor = Colors.Black; if ("Windows.Mobile" == Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily) { StatusBar statusBar = StatusBar.GetForCurrentView(); statusBar.BackgroundOpacity = 1; statusBar.BackgroundColor = targetColor; } }