예제 #1
0
        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);
        }
예제 #2
0
 public static Color ToFormsColor(this global::Windows.UI.Color color)
 {
     return(Color.FromRgba(color.R, color.G, color.B, color.A));
 }