Well, Red/Green/Blue are fairly easy to identify by inspection; what range of values do you need to support?
The problem is that unless you start with a named color, it is very hard to get back to one; IsNamedColor
will return false even if you create an obvious color via FromArgb.
If you only need the actual expected standard colors, you could enumerate the known colors via reflection?
Color test = Color.FromArgb(255,0,0);
Color known = (
from prop in typeof(Color)
.GetProperties(BindingFlags.Public | BindingFlags.Static)
where prop.PropertyType == typeof(Color)
let color = (Color)prop.GetValue(null, null)
where color.A == test.A && color.R == test.R
&& color.G == test.G && color.B == test.B
select color)
.FirstOrDefault();
Console.WriteLine(known.Name);
You might also be able to use this approach as a source of known colors for a more sophisticated algorithm.