Change text colour in console

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2004
Posts: 15
Reputation: axiss is an unknown quantity at this point 
Solved Threads: 0
axiss's Avatar
axiss axiss is offline Offline
Newbie Poster

Change text colour in console

 
0
  #1
Apr 28th, 2006
Hi I was just wondering how you change the text colour of only some of the text in a console when you are using cout to display your text.

I tried using
  1. system("Color XY");

obviously where X and Y are hex numbers and X sets the background color and Y the foreground (or text) colour, but this isn't very useful since the whole screen just changes the the last set of colours in the code for that particular console display instead of just the selected text changing colour.
Me fail English?
Unpossible
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Change text colour in console

 
0
  #2
Apr 28th, 2006
I wouldn't bother. Pointless in my opinion. It's rather hackish.

Can be done in much better way.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,408
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Change text colour in console

 
0
  #3
Apr 28th, 2006
Originally Posted by axiss
Hi I was just wondering how you change the text colour of only some of the text in a console when you are using cout to display your text.
it will all depend on the operating system. MS-Windows, use win32 api console functions. I don't know about *nix but probably use a curses library. You can download some free examples from here
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC