init_pair Subroutine

Purpose

Changes a color-pair definition.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

init_pair( Pair, F, B)
register short Pair,  F,  B;

Description

The init_pair subroutine changes a color-pair definition. A color pair is a combination of a foreground and a background color. If you specify a color pair that was previously initialized, curses refreshes the screen and changes all occurrences of that color pair to the new definition. You must call the start_color subroutine before you call this subroutine.

Return Values

Item Description
OK Indicates successful completion.
ERR Indicates the subroutine failed.

Parameters

Item Description
Pair Identifies the color-pair number. The value of the Pair parameter must be between 1 and COLORS_PAIRS-1.
F Specifies the foreground color number. This number must be between 0 and COLORS-1.
B Specifies the background color number. This number must be between 0 and COLORS-1.

Examples

To initialize the color definition for color-pair 2 to a black foreground (color 0) with a cyan background (color 3), use:

init_pair(2,COLOR_BLACK, COLOR_CYAN);