digital_revenant
digital_revenant

Reputation: 3334

Defining a new color in ncurses

I am trying to learn ncurses and was wondering if I can create my own custom colors. I am aware that by using init_color(), I can modify any pre-defined colors in the ncurses library. But, is there a way I can define a new color with custom RGB values?

Upvotes: 3

Views: 3278

Answers (1)

Craig
Craig

Reputation: 4840

init_color() is the only way to define new colors but the number of colors and color pairs available depends on the terminal you are using.

Many terminals can support up to 256 colors but on most systems the default TERM value is xterm which only supports 8. xterm can be compiled with 256 color support and I think gnome-terminal supports 256. Try changing your TERM enviroment variable to xterm-256color and check the COLORS variable in your ncurses program.

Upvotes: 6

Related Questions