HPlogo MPE/iX Developer's Kit Reference Manual Volume 2: HP 3000 MPE/iX Computer Systems > Chapter 4 CURSES

init_color init_pair

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The init_color and init_pair routines are used to initialize a color pair.

NOTE: The init_color and init_pair routines are not implemented at this time.

Syntax

   #include <curses.h>



   int init_color(short color, short r, short g, short b);

   int init_pair(short pair, short fg, short bg);

Parameters

color

The number of the color to be changed (0 to COLORS).

pair

The number of the color pair to be changed (1 to COLOR_PAIRS -1).

r

The RGB value for the amount of red in color (0 to 1000).

g

The RGB value for the amount of green in color (0 to 1000).

b

The RGB value for the amount of blue in color 0 to 1000).

bg

The number of the background color (0 to COLORS).

fg

The number of the foreground color (0 to COLORS).

Return Values

OK

Successful completion.

ERR

An error occurred.

Description

The init_pair() routine initializes a color pair so that the macro COLOR_PAIR(n) can be used as an attribute. Its first argument is the number of the color pair to be changed; the second argument is the number of the foreground color; the third argument is the number of the background color. The maximum number of color pairs and colors that the terminal can support are defined in the global variables COLOR_PAIRS and COLORS, respectively.

Each time that a color pair is initialized, the screen is refreshed and all occurrences of that color pair are updated to reflect the new definition.

The init_color() routine redefines the color using the number of the color and the RGB values for red, blue, and green as arguments.

The following default colors are defined in curses.h. (CURSES assumes that COLOR_BLACK) is the default background color for all terminals.)

  • COLOR_BLACK

  • COLOR_RED

  • COLOR_GREEN

  • COLOR_YELLOW

  • COLOR_BLUE

  • COLOR_MAGENTA

  • COLOR_CYAN

  • COLOR_WHITE

Each time that a color is redefined with init_color(), the screen is refreshed, and all occurrences of that color are updated to reflect the new definition.

Implementation Considerations

UNIX System V implementation

See Also

can_change_color(), color_content(), has_color(), pair_content(), start_color()

Portability

UNIX System V

Feedback to webmaster