color_content Subroutine

Purpose

Returns the current intensity of the red, green, and blue (RGB) components of a color.

Library

Curses Library (libcurses.a)

Syntax

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

Description

The color_content subroutine, given a color number, returns the current intensity of its red, green, and blue (RGB) components. This subroutine stores the information in the address specified by the R, G, and B arguments. If successful, this returns OK. Otherwise, this subroutine returns ERR if the color does not exist, is outside the valid range, or the terminal cannot change its color definitions.

To determine if you can change the color definitions for a terminal, use the can_change_color subroutine. You must call the start_color subroutine before you can call the color_content subroutine.

Note: The values stored at the addresses pointed to by R, G, and B are between 0 (no component) and 1000 (maximum amount of component) inclusive.

Return Values

Item Description
OK Indicates the subroutine was successful.
ERR Indicates the color does not exist, is outside the valid range, or the terminal cannot change its color definitions.

Parameters

Item Description
B Points to the address that stores the intensity value of the blue component.
Color Specifies the color number. The color parameter must be a value between 0 and COLORS-1 inclusive.
R Points to the address that stores the intensity value of the red component.
G Points to the address that stores the intensity value of the green component.

Example

To obtain the RGB component information for color 10 (assuming the terminal supports at least 11 colors), use:

 short *r, *g, *b; color_content(10,r,g,b);