/// <summary>
 /// Returns the equivalent of the <see cref="System.Drawing.KnownColor.ControlLightLight"/>
 /// colour for a specified colour.
 /// </summary>
 /// <param name="color">The <see cref="System.Drawing.Color"/> to get the lightest
 /// highlight shade for.</param>
 /// <returns>The lightest highlight <see cref="System.Drawing.Color"/> for the specified
 /// colour.</returns>
 public static Color ColorLightLight(Color color)
 {
     if (color.Equals(Color.FromKnownColor(KnownColor.Control)))
     {
         return(Color.FromKnownColor(KnownColor.ControlLightLight));
     }
     else if (color.Equals(Color.Black))
     {
         return(Color.FromArgb(color.A, BlackLightLight));
     }
     else if (color.Equals(Color.White))
     {
         return(Color.FromArgb(color.A, WhiteLightLight));
     }
     else
     {
         int    grey = GreyScale(color);
         HLSRGB hls  = new HLSRGB(color.R, color.G, color.B);
         if (grey > 250)
         {
             hls.Luminance = (WhiteLightLight.R / 255F);
             return(Color.FromArgb(color.A, hls.Color));
         }
         else if (grey < 64)
         {
             hls.Luminance = (BlackLightLight.R / 255F);
             return(Color.FromArgb(color.A, hls.Color));
         }
         else
         {
             hls.LightenColor(0.5F);
             return(Color.FromArgb(color.A, hls.Color));
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Constructs an instance of the class using the settings of another instance.
 /// </summary>
 /// <param name="hlsrgb">The instance to clone.</param>
 public HLSRGB(HLSRGB hlsrgb)
 {
     red        = hlsrgb.Red;
     blue       = hlsrgb.Blue;
     green      = hlsrgb.Green;
     luminance  = hlsrgb.Luminance;
     hue        = hlsrgb.Hue;
     saturation = hlsrgb.Saturation;
 }