private void DisplayColor(SolidColorBrush scb) { Src.Background = scb; SrcTextHex.Text = scb.Color.ToHex(); SrcTextRGB.Text = scb.Color.ToRGB(); Color nearestColor = GetAccentColor(scb.Color); Res.Background = new SolidColorBrush(nearestColor); ResTextHex.Text = nearestColor.ToHex(); ResTextRGB.Text = nearestColor.ToRGB(); string name = AccentManager.GetName(nearestColor.ToString()); ResTextName.Text = !String.IsNullOrWhiteSpace(name) ? name.ToUpper() : "ERROR"; }
private static Color GetAccentColor(Color src) { List <Color> colors = AccentManager.GetKeys().Select(hex => hex.FromHex()).ToList(); return(FindNearestColor(src, colors)); }