Author Topic: How do I change the console colors?  (Read 19914 times)

Offline Silpheed

  • Single posting newcomer
  • *
  • Posts: 4
How do I change the console colors?
« on: September 23, 2008, 12:22:09 pm »
I'm making console apps and learning more programming techniques and I was wondering.. is there any way to change the color of console output after I compile and run an app under GNU/Linux?
The current background color and text color make it hard to read.
I'd prefer black and white instead of 2 shades of gray.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How do I change the console colors?
« Reply #1 on: September 23, 2008, 12:47:00 pm »
Quote
Help
Code::Blocks installation/troubleshooting issues. This is NOT a general programming board.
That's the description of this board.

Your question is not related to C::B in any way and violates the forum rules.

Please use your favourite search-engine to search the internet or read the man page of your console-app.

Offline Silpheed

  • Single posting newcomer
  • *
  • Posts: 4
Re: How do I change the console colors?
« Reply #2 on: September 23, 2008, 01:05:42 pm »
My normal consoles arent colored that way and code::blocks makes some special type of console pop up so I'm wondering how it colors it.
I only came here for help and I've already read the forums rules.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How do I change the console colors?
« Reply #3 on: September 23, 2008, 01:32:37 pm »
I might have misunderstood you.

Nevertheless:
C::B uses "xterm" to run console apps in and fetch input from as default
On my system "xterm" uses white on black.

You can change the console (and/or the parameters sent to it) in "Settings -> Environment -> General Settings -> Terminal to launch console programs".

Offline Silpheed

  • Single posting newcomer
  • *
  • Posts: 4
Re: How do I change the console colors?
« Reply #4 on: September 23, 2008, 03:58:41 pm »
Thank you for that piece of information... that's exactly what I need.

For future people that run across this post here's what I did.

I looked it up: http://www.starnet.com/xwin32kb/edit/Color_and_font_options_for_xterm_and_dtterm/

and you go to Settings > Environment > General Settings

and in "Terminal to Launch Console programs"

You'll see something like 
Code
xterm -T $TITLE -e

If you want (for example) a black background and white text.. you change it to

Code
xterm -bg black -fg white -T $TITLE -e

Some reason it didnt work when I added to the end but I had to add it right after xterm to make it work.

That's how you fix the problem and I hope this helps somebody in the future.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How do I change the console colors?
« Reply #5 on: September 23, 2008, 04:03:51 pm »
Some reason it didnt work when I added to the end but I had to add it right after xterm to make it work.

At the end (after "-e") the command that should be executed is added by C::B:

Quote
-e program [ arguments ... ]
               This option specifies the program (and its command  line  argu‐
               ments)  to be run in the xterm window.  It also sets the window
               title and icon name to be the basename  of  the  program  being
               executed  if  neither  -T nor -n are given on the command line.
               This must be the last option on the command line.

Quote from xterms manpage.