Setting text color in NCurses

Hi,
I have written Display program using C and NCurses ( Screen Handling
Package ). I want to
set color for text. I checked Terminal Emulation type it is qAnsi. I
checked using curses
function has_colors() whether that Terminal will support color or not. The
result is it will support.
Can anyone give me solution for setting text color.


shridhar.

I don’t use ncurse but when I want to display something in color I use
these define and printf

#define BLACK 0
#define RED 1
#define GREEN 2
#define BROWN 3
#define BLUE 4
#define PURPLE 5
#define CYAN 6
#define WHITE 7
#define F_RED 0x10
#define F_GREEN 0x20
#define F_BROWN 0x30
#define F_BLUE 0x40
#define F_PURPLE 0x50
#define F_CYAN 0x60
#define F_WHITE 0x70

First method:
void fcolor( char color )
{
printf( “%c%c%dF”, 0x9b, 0x3d, color);
}
void bcolor( char color )
{
printf( “%c%c%dG”, 0x9b, 0x3d, color);
}
Second method:
printf("\x1B[3%dm", fcolor);
printf("\x1B[4%dm", bcolor);

Hope that will help,

Denis

“Staff” <seto@vsnl.com> a écrit dans le message de news:
akns23$64c$1@inn.qnx.com

Hi,
I have written Display program using C and NCurses ( Screen Handling
Package ). I want to
set color for text. I checked Terminal Emulation type it is qAnsi. I
checked using curses
function has_colors() whether that Terminal will support color or not. The
result is it will support.
Can anyone give me solution for setting text color.


shridhar.

\