示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public static HsbColor ToHsbColor(this Color color)
 {
     return(HsbColor.FromArgbColor(color));
 }