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!!!

Recommended Answers

All 3 Replies

OOPS!!

Sorry guys... I should probabaly include that my compiler is dev c++ version 4.9.9.2,

Plus, are there any libraries out there that do this??

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.