I'm using visual c++ compiler and I want to change the text color in my c++ dos program. What choices do I have if i don't wanna use system function (example: system("color 0a"))?
hail2dthief 0 Newbie Poster
Recommended Answers
Jump to Postconio.h
It has a lot funtions for console input/output.Take a look at it.
TextColor(RED);
TextBackground(BLUE);The color values range from 0-15 with 0 being black and 15 being white
warning,i am not too sure of the funtion names,been a while since i used this, though i …
Jump to PostI used this one to save me some time
This is not Visual C++ dependant, I use this with DEv-C++ as well, you just need the windows headerenum Colors { blue=1, green, cyan, red, purple, yellow, grey, dgrey, hblue, hgreen, hred, hpurple, hyellow, hwhite }; void …
Jump to PostTry this.
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_RED BACKGROUND_INTENSITY);
You can change RED to GREEN or BLUE and BACKGROUND to FOREGROUND.
If you want to mix colors you just separate them with a |
Jump to PostHELLO
Can sombody tell me how can i chang the color of concol background????HELLO... can someone tell me how I can get people to quit posting on ancient old threads?
Jump to PostRead the previous post -- some of the colors are already in that post and they are all defined in windows.h. Console programs have very limited colors, the same as old MS-DOS 6.X from 30 years ago.
All 19 Replies
FireNet 64 Posting Whiz in Training
hail2dthief 0 Newbie Poster
Brian The Mad 0 Newbie Poster
MagikMan74 0 Newbie Poster
ShawnCplus 456 Code Monkey Team Colleague
|\|asrin 0 Newbie Poster
mostermand 0 Light Poster
Comatose 290 Taboo Programmer Team Colleague
|\|asrin 0 Newbie Poster
phr34k1sh 0 Newbie Poster
CppBuilder2006 commented: positive rep (u'll see null rep cos I'm 0) +0
justice igwe 0 Newbie Poster
msehgal 0 Newbie Poster
gadsmuck 0 Newbie Poster
maxicube 0 Light Poster
JadG 0 Newbie Poster
Im_Numma_One 0 Newbie Poster
suneel khatri 0 Newbie Poster
thefasninja1 0 Light Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
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.