tty-color-translate
tty-color-translate is a compiled Lisp function in `tty-colors.el
'.
(tty-color-translate COLOR &optional FRAME)
Given a color COLOR, return the index of the corresponding TTY color.
COLOR must be a string that is either the color's name, or its X-style
specification like "#RRGGBB" or "RGB:rr/gg/bb", where each primary.
color can be given with 1 to 4 hex digits.
If COLOR is a color name that is found among supported colors in
`tty-color-alist', the associated index is returned. Otherwise, the
RGB values of the color, either as given by the argument or from
looking up the name in `color-name-rgb-alist', are used to find the
supported color that is the best approximation for COLOR in the RGB
space.
If COLOR is neither a valid X RGB specification of the color, nor a
name of a color in `color-name-rgb-alist', the returned value is nil.
If FRAME is unspecified or nil, it defaults to the selected frame.