elisp: Text Terminal Colors

 
 28.22 Text Terminal Colors
 ==========================
 
 Text 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
 SeeColor 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 terminals; then this argument
 will specify which terminal to operate on (the default being the
 selected frame’s terminal; SeeInput Focus).  At present, though,
 the FRAME argument has no effect.
 
  -- Function: tty-color-define name number &optional rgb frame
      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-approximate’ to approximate other colors, because Emacs
      will not know what it looks like.
 
  -- Function: tty-color-clear &optional frame
      This function clears the table of defined colors for a text
      terminal.
 
  -- Function: tty-color-alist &optional frame
      This function returns an alist recording the known colors supported
      by a text terminal.
 
      Each element has the form ‘(NAME NUMBER . RGB)’ or ‘(NAME NUMBER)’.
      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.
 
  -- Function: tty-color-approximate rgb &optional frame
      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
      ‘tty-color-alist’.
 
  -- Function: tty-color-translate color &optional frame
      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 ‘nil’.