Text-only terminals usually support only a small number of colors, and the computer uses small integers to select colors on the terminal. This means that the computer cannot reliably tell what the selected color looks like; instead, you have to inform your application which small integers correspond to which colors. However, Emacs does know the standard set of colors and will try to use them automatically.
The functions described in this section control how terminal colors are used by Emacs.
Several of these functions use or return rgb values, described in Color Names.
These functions accept a display (either a frame or the name of a terminal) as an optional argument. We hope in the future to make Emacs support different colors on different text-only terminals; then this argument will specify which terminal to operate on (the default being the selected frame's terminal; see Input Focus). At present, though, the frame argument has no effect.
This function associates the color name name with color number number on the terminal.
The optional argument rgb, if specified, is an rgb value, a list of three numbers that specify what the color actually looks like. If you do not specify rgb, then this color cannot be used by
tty-color-approximateto approximate other colors, because Emacs will not know what it looks like.
This function clears the table of defined colors for a text-only terminal.
This function returns an alist recording the known colors supported by a text-only terminal.
Each element has the form
). Here, name is the color name, number is the number used to specify it to the terminal. If present, rgb is a list of three color values (for red, green, and blue) that says what the color actually looks like.
This function finds the closest color, among the known colors supported for display, to that described by the rgb value rgb (a list of color values). The return value is an element of
This function finds the closest color to color among the known colors supported for display and returns its index (an integer). If the name color is not defined, the value is