private static void SetBrushWithOpacity(ResourceDictionary dictionary, string name, string immersiveAccentName, double opacity) { var color = AccentColorService.GetColorByTypeName(immersiveAccentName); color.A = (byte)(opacity * 255); if (!((SolidColorBrush)dictionary[name]).IsFrozen) { ((SolidColorBrush)dictionary[name]).Color = color; } }
private static Color GetWindowBackgroundColor() { string resource; if (SystemParameters.HighContrast) { resource = "ImmersiveApplicationBackground"; } else if (UseAccentColor) { resource = IsWindowTransparencyEnabled ? "ImmersiveSystemAccentDark2" : "ImmersiveSystemAccentDark1"; } else { resource = "ImmersiveDarkChromeMedium"; } var color = AccentColorService.GetColorByTypeName(resource); color.A = (byte)(IsWindowTransparencyEnabled ? 190 : 255); return(color); }
private static void ReplaceBrush(ResourceDictionary dictionary, string name, string immersiveAccentName) { dictionary[name] = new SolidColorBrush(AccentColorService.GetColorByTypeName(immersiveAccentName)); }