[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


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


OK Indicates successful completion.
ERR Indicates the subroutine failed.

Parameters


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);

Implementation Specifics

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

Related Information

The init_color (init_color Subroutine) subroutine, start_color (start_color Subroutine) subroutine.

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


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]