start_color Subroutine

Purpose

Initializes color.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>
start_color() 

Description

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.

Return Values

Item Description
ERR Indicates the terminal does not support colors.
OK Indicates the terminal does support colors.

Example

To enable the color support for a terminal that supports color, use:

start_color();