Initializes color.
Curses Library (libcurses.a)
#include <curses.h>
start_color()
The start_color subroutine initializes color. This subroutine requires no arguments. You must call the start_color subroutine if you intend to use color in your application. Except for the has_colors and can_change_color subroutines, you must call the start_color subroutine before any other color manipulation subroutine. A good time to call start_color is right after calling the initscr routine and after establishing whether the terminal supports color.
The start_color routine initializes the following basic colors:
Item | Description |
---|---|
COLOR_BLACK | 0 |
COLOR_BLUE | 1 |
COLOR_GREEN | 2 |
COLOR_CYAN | 3 |
COLOR_RED | 4 |
COLOR_MAGENTA | 5 |
COLOR_YELLOW | 6 |
COLOR_WHITE | 7 |
The subroutine also initializes two global variables: COLORS and COLOR_PAIRS. The COLORS variable is the maximum number of colors supported by the terminal. The COLOR_PAIRS variable is the maximum number of color-pairs supported by the terminal.
The start_color subroutine also restores the terminal's colors to the original values right after the terminal was turned on.
Item | Description |
---|---|
ERR | Indicates the terminal does not support colors. |
OK | Indicates the terminal does support colors. |
To enable the color support for a terminal that supports color, use:
start_color();