Jump to content

Change console colour

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Termana

Termana

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,057 posts
In this tutorial I will show you how to change the text background and foreground colour in the console window.

1. Start up a new Console Application project (File -> New Project -> Console Application -> OK)

2. Go into the main function in Program.cs

3. And use this code:

Console.BackgroundColor = ConsoleColor.Red;

Console.ForegroundColor = ConsoleColor.Black;


This changes the Background colour to Red and the Foreground colour to Black.
You can then test it by putting in this code:

Console.WriteLine("Colour Test");

and then run it.
You can replace the Red and Black with any of the colour's I have listed below.
Enjoy

Black
Blue
Green
Cyan
DarkBlue
DarkGreen
DarkCyan
DarkRed
DarkYellow
DarkMagenta
DarkGray
Red
White
Yellow
Gray
Magenta

Interested in participating in community events?
Want to harness your programming skill and turn it into absolute prowess?
Come join our programming events!


#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Nice bit of information. Too short for +rep though but thanks for the post/read! :D

#3
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Well, duh! Of course, you are only changing a property. Even an idiot would be able to figure this out. ******* n00b.

I'm only joking, of course. :)
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#4
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts

Santa Claus said:

Well, duh! Of course, you are only changing a property. Even an idiot would be able to figure this out. ******* n00b.

I'm only joking, of course. :)

Or were you :)?
Posted Image

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Nup, I like Termana. In ways you would not have imagined. :)
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#6
cismarel

cismarel

    Learning Programmer

  • Members
  • PipPipPip
  • 37 posts
Thanks...