LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-11-2004, 08:44 PM   #1
kamransoomro84
Member
 
Registered: Feb 2004
Location: Pakistan
Distribution: OpenSUSE 10.2
Posts: 241

Rep: Reputation: 30
Changing the colour of text


Hi. I was just wondering how I could change the colour of output text in a program in C++. Not using ncurses winows of course. Thanks.
 
Old 05-12-2004, 08:57 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
You can print the ANSI code for the color.

printf("\033[34;1mBright Blue\033[37;0m\n");

That will change the color to bright blue and then back to white.

Here's a really good site that talks about all of the ANSI codes and lists which numbers are for which color, etc.:

http://www.fh-jena.de/~gmueller/Kurs...esc_vt100.html

Last edited by itsme86; 05-12-2004 at 08:58 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Change Console Text Colour flamesrock Linux - Software 3 05-10-2005 07:49 PM
Changing the colour of the toolbar applets (Gnome) Frankablu Linux - General 0 10-03-2004 02:32 PM
Changing default colour KroniX Linux - General 2 03-16-2004 03:12 AM
Changing the colour of man pages Stumo Linux - Software 4 09-24-2003 03:16 PM
Aterm Text Colour cclavey Linux - Software 5 07-28-2003 10:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration