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

Technical Reference: Base Operating System and Extensions , Volume 2

init_color Subroutine


Changes a color definition.


Curses Library (libcurses.a)


#include <curses.h>

init_color( Color, R,
G, B)
register short Color, R, G, B;


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.


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.


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


Implementation Specifics

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

Related Information

The start_color (start_color Subroutine) subroutine.

Curses Overview for Programming and 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 ]