Returns the current intensity of the red, green, and blue (RGB) components of a color.
Curses Library (libcurses.a)
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.
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. |
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. |
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);