Colors in NCurses
In the name of God
Hi all, I can not change color in the screen using NCurses. There are some functions for this mean, none of them change color : attrset, initpair, start_color,.... Help please/ |
#include <ncurses.h>
int main() { initscr(); noecho(); crbreak(); start_color(); init_pair(1, COLOR_RED, COLOR_BLACK); attron(COLOR_PAIR(1)); printw("Hey,i'm in colour"); attroff(COLOR_PAIR(1)); getch(); endwin(); } any more help needed try http://www.linuxselfhelp.com/HOWTO/N...WTO/color.html |
just a correction....
line 6 : crbreak(); should be : cbreak(); Other than that it works... |
Thanks.
I'll check, BTW what does cbreak do? I have an NCurses manual (about 200kb HTML) but it has very few discriptions, is any more compelete manual available on the net? |
?
|
from the howto i posted in the first post.....
4.2. raw() and cbreak() Normally the terminal driver buffers the characters a user types until a new line or carriage return is encountered. But most programs require that the characters be available as soon as the user types them. The above two functions are used to disable line buffering. The difference between these two functions is in the way control characters like suspend (CTRL-Z), interrupt and quit (CTRL-C) are passed to the program. In the raw() mode these characters are directly passed to the program without generating a signal. In the cbreak() mode these control characters are interpreted as any other character by the terminal driver. I personally prefer to use raw() as I can exercise greater control over what the user does. :) |
Thancks Sidey,
Where is this Howto? |
its at the start of the thread but here again just in case :)
http://www.linuxselfhelp.com/HOWTO/...OWTO/color.html |
All times are GMT -5. The time now is 04:45 AM. |