comp • gb.ncurses • color

Color (gb.ncurses)

Terminal color is represented by means of "color pairs". These are just numbers, from 0 to Color.Pairs - 1 (0 being the default for everything) that are associated to a foreground and to a background color and are used as attributes for characters on the screen.
Similarly, all colors - see the color constants in this class which represent the ANSI standard ones - are just numbers from 0 to Color.Colors - 1 which are, connected to RGB values.

The more important part, however, is that one has to stick to that number representation, especially for color pairs. You can fancily color one line of text with color pair 1 (which was previously defined by you) but as soon as you change the definition of color pair 1, the line mentioned above will change to that new definition! (BTW, you access a particular color pair through the array accessors of this class)

Having said above that 0 is the default color pair for everything, think of the Window class... It is true for it also. So, using the Window.Background and Window.Foreground properties affect exactly the same color pair that was set through Window.Attributes.Color, which, in turn, is 0 per default.

I hope, it was clarified that using color will take some extra thought...

This class is static.
This class acts like a
Returns a virtual object used to manage a color pair identified by Index
read-only
static array.

Static properties

Static methods Constants
Available   CanChange   Count   Set  
The color Black
Black  
The color Blue
Blue  
The color Cyan
Cyan  
The color Green
Green  
The color Magenta
Magenta  
The color Red
Red  
The color White
White  
The color Yellow
Yellow