color-distance is a built-in function in `C source code'.

(color-distance COLOR1 COLOR2 &optional FRAME)

Return an integer distance between COLOR1 and COLOR2 on FRAME.
COLOR1 and COLOR2 may be either strings containing the color name,
or lists of the form (RED GREEN BLUE).
If FRAME is unspecified or nil, the current frame is used.