If I use the use_default_colors() function, when I start_color() the background color of the terminal is not grey anymore, but black (The same I set in profile preferences), this is what I want because I don't like the grey. The problem is when I print something with color, the background color of the char I print is still the same grey. It is not noticeable if I don't use the use_default_colors() function, because everything is grey. But you can see it clearly if I use it. See screens
Is there a way to remove this grey and have it black, having a portable code? I want other people to see the same colors i set. For this reason I shouldn't be using use_default_colors() anyway, or maybe I can use it and change manually the background color with bkgd(); but I have the same problem. COLOR_BLACK is not actually black.
With use_default_colors()
Without default colors
#include <curses.h>
int main (){
int maxx,maxy;
char test = '*';
char test2 = '#';
initscr();
noecho();
curs_set(0);
start_color();
//use_default_colors();
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_CYAN, COLOR_BLACK);
getmaxyx(stdscr,maxy,maxx);
do{
attron(COLOR_PAIR(1));
mvaddch(10,10,test);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(2));
mvaddch(10,12,test2);
attroff(COLOR_PAIR(2));
}while(getch() != 'q');
endwin();
return;
}
After invoking
use_default_colors(), use-1ininit_pair()to get the background color of the cells to match the default, instead ofCOLOR_BLACK:On the other hand, if you want
COLOR_BLACKto be really black, you could try redefining it viainit_color():This isn't supported by all terminals, but should give pretty similar results where it is.