wbest
July 15th, 2009, 10:46 PM
Hey, I'm trying to change the font color (foreground color) in Ubuntu Linux terminal through C++.
Ideally, I'd like the code to look similar to this (Windows Console code):
RED = FOREGROUND_RED,
GREEN = FOREGROUND_GREEN,
BLUE = FOREGROUND_BLUE,
GRAY = RED | GREEN | BLUE,
BROWN = RED | GREEN,
MAGENTA = RED | BLUE,
CYAN = GREEN | BLUE,
YELLOW = BROWN | FOREGROUND_INTENSITY,
B_RED = RED | FOREGROUND_INTENSITY,
B_GREEN = GREEN | FOREGROUND_INTENSITY,
B_BLUE = BLUE | FOREGROUND_INTENSITY,
WHITE = GRAY | FOREGROUND_INTENSITY,
B_YELLOW = YELLOW | FOREGROUND_INTENSITY,
B_MAGENTA = MAGENTA | FOREGROUND_INTENSITY,
B_CYAN = CYAN | FOREGROUND_INTENSITY
And then be able to use those elsewhere in my code.
How can I do this? I've read I might be able to do this with ncurses, but I haven't tested yet as this is for work, and I can't download ncurses because of the network security.
Ideally, I'd like the code to look similar to this (Windows Console code):
RED = FOREGROUND_RED,
GREEN = FOREGROUND_GREEN,
BLUE = FOREGROUND_BLUE,
GRAY = RED | GREEN | BLUE,
BROWN = RED | GREEN,
MAGENTA = RED | BLUE,
CYAN = GREEN | BLUE,
YELLOW = BROWN | FOREGROUND_INTENSITY,
B_RED = RED | FOREGROUND_INTENSITY,
B_GREEN = GREEN | FOREGROUND_INTENSITY,
B_BLUE = BLUE | FOREGROUND_INTENSITY,
WHITE = GRAY | FOREGROUND_INTENSITY,
B_YELLOW = YELLOW | FOREGROUND_INTENSITY,
B_MAGENTA = MAGENTA | FOREGROUND_INTENSITY,
B_CYAN = CYAN | FOREGROUND_INTENSITY
And then be able to use those elsewhere in my code.
How can I do this? I've read I might be able to do this with ncurses, but I haven't tested yet as this is for work, and I can't download ncurses because of the network security.