Пример #1
0
        /// <summary>
        /// Gets Color brightened by a specified factor.
        /// </summary>
        /// <param name="source">Source Color</param>
        /// <param name="factor">Factor</param>
        /// <returns>Brightened Color</returns>
        public static Color ToBrightened(this Color source, float factor)
        {
            if (factor <= 0F)
            {
                throw new ArgumentOutOfRangeException(nameof(factor), factor, "The factor must be positive.");
            }

            var bridgeColor = HsbColor.FromArgb(source);

            bridgeColor.B = Min(1F, bridgeColor.B * factor);

            return(bridgeColor.ToArgb());
        }
Пример #2
0
 public static HsbColor ToAhsb(this Color source) =>
 HsbColor.FromArgb(source);