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

has_color can_change_color color_content pair_content

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The has_color set of routines is used to get information about colors on terminal.

Syntax

   #include <curses.h>



   bool has_colors();

   bool can_change_color();



   int pair_content(short pair, short *fg, short *bg);

   int color_content(short color, short *r, short *g, short *b);

Parameters

color

The number of the color for which to provide information (0 to COLORS).

pair

The number of the color pair for which to provide information (1 to COLOR_PAIRS - 1).

r

A pointer to the RGB value for the amount of red in color.

g

A pointer to the RGB value for the amount of green in color.

b

A pointer to the RGB value for the amount of blue in color.

bg

A pointer to the number of the background color (0 to COLORS) in pair.

fg

A pointer to the number of the foreground color (0 to COLORS) in pair.

Return Values

OK

Successful completion.

ERR

An error occurred.

Description

The has_colors() routine returns TRUE if the terminal supports color. The can_change_color() routine returns TRUE if the terminal can support color and the colors can be changed. These routines are useful when writing terminal-independent programs; these routines could be used to determine whether to replace color with another attribute on a particular terminal.

The color_content() routine provides information on the amount of red, blue, and green in a particular color. The intensity of each color is stored in the addresses pointed to by r, b, and g, respectively. The values returned range from 0 (no component of that color) to 1000 (maximum amount of component).

The pair_content() routine provides information on what colors are in the specified color pair. The number of the foreground and background colors are stored in the addresses pointed to by fg and bg, respectively. The values stored in fg and bg range from 0 to COLORS. The color pair number, pair, ranges from 1 to COLOR_PAIRS -1.

Implementation Considerations

UNIX System V implementation

See Also

init_color(), init_pair(), start_color()

Portability

UNIX System V

Feedback to webmaster