Beispiel #1
0
 public static RGB GetBestForegroundColor(this RGB color)
 {
     return(color.Luminance() > rgbThreshold ? RGB.Black : RGB.White);
     //return (color.Red * 0.299 + color.Green * 0.587 + color.Blue * 0.114 > 160) ? RGB.White : RGB.Black;
 }
Beispiel #2
0
 /// <summary>
 /// Gets the best foreground color given the specified background color.
 /// </summary>
 /// <param name="color">The background color.</param>
 /// <returns>The best <see cref="RGB"/> foreground color.</returns>
 public static RGB GetBestForegroundColor(this RGB color)
 {
     return(color.Luminance() > rgbThreshold ? RGB.Black : RGB.White);
 }