Making Console output text colored in C++
Advertisements
| Top Tutorials | New Tutorials | Submit | Login | Register |
Tutorial Detail
Making Console output text colored in C++
Hello! I am going to show you, yes you, how to color your text in a console application using the WIN API.http://www.radcpp.com/article.php?art_id=1170554318{76}
Total Hits: 3656
Total Votes: 36 votes
Category: C and C++/Game Programming
Submitted on: 2008-04-16 02:00:31
Submitted By: Shekhar
Description:
As you can now already see, it doesn't take much effort to make colored text.The set_color function dose all of the magic. We start off by making a output handle. Then, we set
the console text using SetConsoleTextAttribute. Its first argument is what it should change. We use
the handle that we just made to tell it that we want to edit the color of the output text. The second argument
is the number of the color you want to change to. When you call the
set_color function, we put a number of the color we want to change
the text to. Try to figure out most of the colors on your own.
All I'm gonna say is if you give the function more then a one didget
number, the background color of the text will change, too. More detail...
Rating Detail
| Stars | Percentage | Total Vote |
|---|---|---|
![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() ![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() ![]() ![]() |
![]() ![]() 16.67% |
6 |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() 16.67% |
6 |





16.67%

16.67%

16.67%

16.67%

16.67%