If a terminal supports color, you
can use the color manipulation subroutines to include color in your curses
program. Before manipulating colors, you should test whether a terminal
supports color. To do this, you can use either the
has_colors subroutine or the can_change_color
subroutine. The can_change_color subroutine also checks to
see if a program can change the terminal's color definitions.
Neither of these subroutines requires an argument.
|can_change_color||Checks to see if the terminal supports colors and changing of the color definition.|
|has_colors||Checks that the terminal supports colors.|
|start_color||Initializes the eight basic colors and two global variables, COLORS and COLOR_PAIRS.|
Once you have determined that the terminal supports color, you must call the start_color subroutine before calling other color subroutines. It is a good practice to call this subroutine right after the initscr subroutine and after a successful color test. The COLORS global variable defines the maximum number of colors the terminal supports. The COLOR_PAIRS global variable defines the maximum number of color pairs the terminal supports.
Chapter 2, The Curses Library
Manipulating Video Attributes