[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

init_pair Subroutine


Changes a color-pair definition.


Curses Library (libcurses.a)


#include <curses.h>
init_pair(Pair, F, B)
register short Pair, F, B;


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

OK Indicates successful completion.
ERR Indicates the subroutine failed.


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.


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


Implementation Specifics

This routine is part of Base Operating System (BOS) Runtime.

Related Information

The init_color subroutine, start_color subroutine.

Curses Overview for Programming, List of Curses Subroutines, Manipulating Video Attributes in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

[ Previous | Next | Contents | Glossary | Home | Search ]