I have an ncurses-based text application i am writing. I have a function called colorPlot:
void colorPlot(int x, int y, int foregroundColor, int backgroundColor, char plotChar)
{
init_pair(0, foregroundColor, backgroundColor);
attrset(COLOR_PAIR(0));
mvaddch(y, x, plotChar);
}
But whenever i try to call it in my main function:
int main(void) {
initscr();
start_color();
colorPlot(1, 1, COLOR_RED, COLOR_WHITE, '@');
refresh();
getch();
endwin();
}
It only prints white-on-black. Why isn't it printing red-on-white?
Color pair 0 (see manual for start_color) is reserved:
color pair 0 is special; it denotes "no color".
Color pair 0 is assumed to be white on black, but is actually whatever the terminal implements before color is initialized. It cannot be modified by the application.