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

init_color Subroutine

Purpose

Changes a color definition.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>
init_color(Color, R, G, B)
register short Color, R, G, B;

Description

The init_color subroutine changes a color definition. A single color is defined by the combination of its red, green, and blue components. The init_color subroutine changes all the occurrences of the color on the screen immediately. If the color is changed successfully, this subroutines returns OK. Otherwise, it returns ERR.

Note: The values for the red, green, and blue components must be between 0 (no component) and 1000 (maximum amount of component). The init_color subroutine sets values less than 0 to 0 and values greater than 1000 to 1000.

To determine if you can change a terminal's color definitions, see the can_change_color subroutine.

Return Values

OK Indicates the color was changed successfully.
ERR Indicates the color was not changed.

Parameters

Color Identifies the color to change. The value of the parameter must be between 0 and COLORS-1.
R Specifies the desired intensity of the red component.
G Specifies the desired intensity of the green component.
B Specifies the desired intensity of the blue component.

Examples

To initialize the color definition for color 11 to violet on a terminal that supports at least 12 colors, use:

init_color(11,500,0,500);

Implementation Specifics

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

Related Information

The start_color subroutine.

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


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