Imagine we how some basic colors:
RED = Color ((196, 2, 51), \"RED\")
ORANGE = Color ((255, 165, 0), \"ORANGE\")
YELLOW = Color ((255, 205, 0), \"YELLOW\")
GREEN
Treat colors as vectors and count distance between the given and each of them and choose the one, which is the least. The simplest distance can be: |a1 - a2| + |b1 - b2| + |c1 - c2|
.
Read this too: http://answers.yahoo.com/question/index?qid=20071202234050AAaDGLf, there is a better distance function described.