944,198 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 9427
  • C++ RSS
Apr 28th, 2006
0

Change text colour in console

Expand Post »
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
C++ Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
axiss is offline Offline
15 posts
since Aug 2004
Apr 28th, 2006
0

Re: Change text colour in console

I wouldn't bother. Pointless in my opinion. It's rather hackish.

Can be done in much better way.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 28th, 2006
0

Re: Change text colour in console

Quote 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
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,963 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: postgres server function
Next Thread in C++ Forum Timeline: C++ class file that uses an array





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC