Home Linux Community Forums Software Command Line ncurses - start_color - screen color

ncurses - start_color - screen color

Link to this post 11 Jun 12

When using start_color command in ncurses the screen starts with a black background. Is there any way of resetting this to another color?

If this is not the appropriate forum for this question - sorry and please redirect me.



Link to this post 13 Jun 12

I don't use ncurses, but there are a few extensions that are mentioned at this link which you might find useful:

Link to this post 13 Jun 12

Thanks for the link I will follow it up.


Link to this post 14 Jun 12

Let's back to the basics ! Have u added refresh(); after declaring color code.....start_color routine requires no arguments. It is good practice to call this routine right after initscr();. There r some basic colors like black, red, green, yellow, blue, magenta, cyan, and white. The sample code looks like that:
Don't confuse this code with ur original one, this is just an example. COLOR_PAIR is declared as own func and 1 indicates as Red color. Please see here for tricks and color codes:

Link to this post 14 Jun 12

Are you trying to change the color in your terminal @Chronos?

Link to this post 14 Jun 12

I contacted Thomas Dickey and he very kindly helped me. Use use_default_colors() after start_color()

See - search for use_default_colors() This will use the terminal colors as you have them set up.

For example:

initscr(); // Start curses mode

if(has_colors() == FALSE) // Check the terminal has colour capability
endwin(); // Close Window and leave ncurses
printf("Your terminal does not support colour. ");
return(1); // Leave the program

start_color(); // Start colour mode



Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Linux Training / Board

/** BC-056 Ameex changes to add tracking code - 2016-01-22 **/ ?>