/// <summary> /// Updates the theme color of the app shell hamburger. /// </summary> /// <param name="theme">The theme to use.</param> public void UpdateAppShellHamburgerTheme(ApplicationTheme theme) { IAppColorProperties colorProperties = (theme == ApplicationTheme.Light) ? ColorPropertiesLight : ColorPropertiesDark; if (colorProperties == null) { return; } if (UseAppShell) { var appshell = Window.Current.Content as AppShell; if (appshell != null) { appshell.SetToggleButtonColors(colorProperties.AppShellHamburgerForeground, colorProperties.AppShellHamburgerBackground); } } }
/// <summary> /// Updates the theme color of the status bar (phone only). /// </summary> /// <param name="theme">The theme to use.</param> public void UpdateStatusBarTheme(ApplicationTheme theme) { if (_statusBarService.IsSupported) { IAppColorProperties colorProperties = (theme == ApplicationTheme.Light) ? ColorPropertiesLight : ColorPropertiesDark; if (colorProperties == null) { return; } if (colorProperties.StatusBarBackground.HasValue) { _statusBarService.BackgroundColor = colorProperties.StatusBarBackground.Value; } if (colorProperties.StatusBarForeground.HasValue) { _statusBarService.ForegroundColor = colorProperties.StatusBarForeground.Value; } } }
/// <summary> /// Updates the theme color of the title bar (pc only). /// </summary> /// <param name="theme">The theme to use.</param> private void UpdateTitleBarTheme(ApplicationTheme theme) { IAppColorProperties colorProperties = (theme == ApplicationTheme.Light) ? ColorPropertiesLight : ColorPropertiesDark; if (colorProperties == null) { return; } var coreTitleBar = ApplicationView.GetForCurrentView().TitleBar; coreTitleBar.BackgroundColor = colorProperties.TitleBarBackground; coreTitleBar.ButtonBackgroundColor = colorProperties.TitleBarBackground; coreTitleBar.ButtonForegroundColor = colorProperties.TitleBarForeground; coreTitleBar.ButtonHoverBackgroundColor = colorProperties.Theme; coreTitleBar.ButtonHoverForegroundColor = Colors.White; coreTitleBar.ButtonInactiveBackgroundColor = colorProperties.TitleBarBackground; coreTitleBar.ButtonInactiveForegroundColor = Colors.Gray; coreTitleBar.ButtonPressedBackgroundColor = Colors.DarkGray; coreTitleBar.ButtonPressedForegroundColor = Colors.White; coreTitleBar.ForegroundColor = colorProperties.TitleBarForeground; coreTitleBar.InactiveBackgroundColor = colorProperties.TitleBarBackground; coreTitleBar.InactiveForegroundColor = Colors.Gray; }