public static SolidColorBrush ChangeSaturation(this SolidColorBrush brush, double saturationFactor) { Color color = brush.Color; HsbColor hsbColor = HsbColor.FromArgbColor(color); hsbColor.Saturation *= saturationFactor; if (hsbColor.Saturation > 1.0) { hsbColor.Saturation = 1.0; } SolidColorBrush result = new SolidColorBrush(hsbColor.ToArgbColor()); return(result); }
public static SolidColorBrush ChangeLightness(this SolidColorBrush brush, double lightnessFactor) { Color color = brush.Color; HsbColor hsbColor = HsbColor.FromArgbColor(color); hsbColor.Brightness *= lightnessFactor; if (hsbColor.Brightness > 1.0) { hsbColor.Brightness = 1.0; } SolidColorBrush result = new SolidColorBrush(hsbColor.ToArgbColor()); return(result); }
public static HsbColor ToHsbColor(this Color color) { return(HsbColor.FromArgbColor(color)); }