Hi, I have absolutely no clue how to implement Ascii color into a console program. I have tried google, but it only finds irrelevant things...
~thanks!!!!!~
Kodiak!!!
Using colour in console programs, is, as you might have guessed non standard/portable.
You could of course use a third party graphics library or if you are on windows perhaps you might want to use:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048382857&id=1043284392
Personally I don't see any reason for colours in the console window.
If you put
void setcolor(unsigned short color)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);
}
this before the main process you can call the setcolor function before you print to the screen using numbers 0 to 15 as parameters eg
setcolor(3);
cout << "I'm blue";
Experiment and see what colors you get, 0 is black so you might not see anything!
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.