public static Color FindColorMatch (Color c) { uint argb = (uint) c.ToArgb (); // 1-based const int first_real_color_index = (int) KnownColor.AliceBlue; const int last_real_color_index = (int) KnownColor.YellowGreen; for (int i = first_real_color_index - 1; i < last_real_color_index; i++) { if (argb == KnownColors.ArgbValues [i]) return KnownColors.FromKnownColor ((KnownColor)i); } return Color.Empty; }
internal static Color_ FromBGR(int bgr) { Color_ result = Color_.FromArgb(0xFF, (bgr & 0xFF), ((bgr >> 8) & 0xFF), ((bgr >> 16) & 0xFF)); Color_ known = KnownColors.FindColorMatch(result); return((known.IsEmpty) ? result : known); }