Example #1
0
 public static RGBA GetBestForegroundColor(this RGBA color)
 {
     return(color.Luminance() > rgbThreshold ? RGBA.Black : RGBA.White);
     //return (color.Red * 0.299 + color.Green * 0.587 + color.Blue * 0.114 > 160) ? RGBA.White : RGBA.Black;
 }
Example #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="RGBA"/> foreground color.</returns>
 public static RGBA GetBestForegroundColor(this RGBA color)
 {
     return(color.Luminance() > rgbThreshold ? RGBA.Black : RGBA.White);
 }