- the programmer can change the colors. The routine
- <B>color_content</B> allows a programmer to extract the amounts
- of red, green, and blue components in an initialized
- color. The routine <B>pair_content</B> allows a programmer to
- find out how a given color-pair is currently defined.
-
- <B>Routine</B> <B>Descriptions</B>
- The <B>start_color</B> routine requires no arguments. It must be
- called if the programmer wants to use colors, and before
- any other color manipulation routine is called. It is
- good practice to call this routine right after <B>initscr</B>.
- <B>start_color</B> initializes eight basic colors (black, red,
- green, yellow, blue, magenta, cyan, and white), and two
- global variables, <B>COLORS</B> and <B>COLOR_PAIRS</B> (respectively
- defining the maximum number of colors and color-pairs the
- terminal can support). It also restores the colors on the
- terminal to the values they had when the terminal was just
- turned on.
-
- The <B>init_pair</B> routine changes the definition of a color-
- pair. It takes three arguments: the number of the color-
- pair to be changed, the foreground color number, and the
- background color number. For portable applications:
-
- - The value of the first argument must be between <B>1</B> and
- <B>COLOR_PAIRS-1</B>.
-
- - The value of the second and third arguments must be
- between 0 and <B>COLORS</B> (the 0 color pair is wired to
- white on black and cannot be changed).
-
- If the color-pair was previously initialized, the screen
- is refreshed and all occurrences of that color-pair is
- changed to the new definition.
-
- As an extension, ncurses allows you to set color pair 0
- via the <B>assume_default_colors</B> routine, or to specify the
- use of default colors (color number <B>-1</B>) if you first
- invoke the <B>use_default_colors</B> routine.
-
- The <B>init_color</B> routine changes the definition of a color.
- It takes four arguments: the number of the color to be
- changed followed by three RGB values (for the amounts of
- red, green, and blue components). The value of the first
- argument must be between <B>0</B> and <B>COLORS</B>. (See the section
- <B>Colors</B> for the default color index.) Each of the last
- three arguments must be a value between 0 and 1000. When
- <B>init_color</B> is used, all occurrences of that color on the
- screen immediately change to the new definition.
-
- The <B>has_colors</B> routine requires no arguments. It returns
- <B>TRUE</B> if the terminal can manipulate colors; otherwise, it
- returns <B>FALSE</B>. This routine facilitates writing terminal-
- independent programs. For example, a programmer can use
- it to decide whether to use color or some other video
- attribute.
-
- The <B>can_change_color</B> routine requires no arguments. It
- returns <B>TRUE</B> if the terminal supports colors and can
- change their definitions; other, it returns <B>FALSE</B>. This
- routine facilitates writing terminal-independent programs.
-
- The <B>color_content</B> routine gives programmers a way to find
- the intensity of the red, green, and blue (RGB) components
- in a color. It requires four arguments: the color number,
- and three addresses of <B>short</B>s for storing the information
- about the amounts of red, green, and blue components in
- the given color. The value of the first argument must be
- between 0 and <B>COLORS</B>. The values that are stored at the
- addresses pointed to by the last three arguments are
- between 0 (no component) and 1000 (maximum amount of com-
- ponent).
-
- The <B>pair_content</B> routine allows programmers to find out
- what colors a given color-pair consists of. It requires
- three arguments: the color-pair number, and two addresses
- of <B>short</B>s for storing the foreground and the background
- color numbers. The value of the first argument must be
- between 1 and <B>COLOR_PAIRS-1</B>. The values that are stored
- at the addresses pointed to by the second and third argu-
- ments are between 0 and <B>COLORS</B>.
-
- <B>Colors</B>
- In <B><curses.h></B> the following macros are defined. These are
- the default colors. <B>curses</B> also assumes that <B>COLOR_BLACK</B>
- is the default background color for all terminals.
-
- <B>COLOR_BLACK</B>
- <B>COLOR_RED</B>
- <B>COLOR_GREEN</B>
- <B>COLOR_YELLOW</B>
- <B>COLOR_BLUE</B>
- <B>COLOR_MAGENTA</B>
- <B>COLOR_CYAN</B>
- <B>COLOR_WHITE</B>