+1  A: 

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.

Marc Gravell
full spectrumi have byte image processing from my web cam.http://i35.tinypic.com/2yvorau.png
w-ll
A slightly simpler source of standard colours is the KnownColors enum. That way you don't have to use GetProperties etc. (Use Color.FromKnownColor.)
Jon Skeet
+3  A: 

If you have a list of known colors with names, you can see which of those known colors a given target color is 'closest' to, using a 'closeness' function along the lines of (F# code):

let Diff (c1:Color) (c2:Color) =
    let dr = (c1.R - c2.R) |> int
    let dg = (c1.G - c2.G) |> int
    let db = (c1.B - c2.B) |> int
    dr*dr + dg*dg + db*db

Whichever one of the known colors has the smallest diff to the target color you want to name, use that name.

Brian
oh that's pretty cool
xxxxxxx
alto a pretty piece of code.this solution just gives you the max. of the rgbs difference. not really what im asking. i want to give a color and find close. but writing this i answered it in my head. i will post code later
w-ll
A: 

I personally find it more natural to think of colors in terms of hue/saturation/brightness than RGB values, and I think that would work well for you in this case. Try this:

Assign color names to certain ranges of the spectrum, as you see fit. For example, maybe red is 0-39, orange is 40-79, etc. (those are arbitrary numbers - I have no idea if they fit on any kind of scale or not). Then calculate the hue from your RGB value (you can find a formula here, although there may be others). Once you know the hue, you know what range of the spectrum it's in, and you can give it a name.

Jonathan Schuster