public static global::Windows.UI.Color GetContrastingColor(this global::Windows.UI.Color color) { var nThreshold = 105; int bgLuminance = Convert.ToInt32(color.R * 0.2 + color.G * 0.7 + color.B * 0.1); global::Windows.UI.Color contrastingColor = 255 - bgLuminance < nThreshold ? Colors.Black : Colors.White; return(contrastingColor); }
public static Color ToFormsColor(this global::Windows.UI.Color color) { return(Color.FromRgba(color.R, color.G, color.B, color.A)); }