1
Programming / Re: Curses - Issue with init_color
« on: January 26, 2009, 10:35:13 PM »QuoteIf a terminal is capable of redefining colors, the programmer can use the routine init_color to change the definition of a color.
keyword here being _IF_. It is not garunteed to support it. and I'd wager outside of an 256 color xterm it probably wont be supported.
init_color will return an error if its unsupported so you can always check that, if no error is returned maybe something else is wrong.
are you correctly doing init_pairs as well?
I've already tested the console to confirm that it supports redefining colors. I'm not getting an error thrown when I try to do it.
My init_pairs are as follows:
Code: [Select]
init_pair(0, COLOR_BLACK, COLOR_BLACK);
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
init_pair(8, COLOR_GREEN, COLOR_BLACK);
I'll then use attron(COLOR_PAIR(n)); to turn on whatever color I want to use.
i.e. -
Code: [Select]
attron(COLOR_PAIR(0)); // turns on black/black