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.
TIA
Alan
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.
TIA
Alan
I don't use ncurses, but there are a few extensions that are mentioned at this link which you might find useful:
https://www.gnu.org/software/ncurses/
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:
start_color();
color_set(COLOR_PAIR(1));
refresh();
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: http://uw714doc.sco.com/en/SDK_charm/_Color_Manipulation.html
I contacted Thomas Dickey and he very kindly helped me. Use use_default_colors() after start_color()
See http://invisible-island.net/ncurses/ncurses-intro.html - 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
use_default_colors();
...
...
Alan
The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.
Join / Linux Training / Board