I'm writing a small text-based adventure in C# that uses the command prompt for everything, and I'm looking for a way to change the colour of outputted text. None of the methods I've looked at have worked properly.
Asked
Active
Viewed 111 times
-4
-
4Show us what you have tried. – Nigel B Oct 03 '13 at 10:39
-
1Tried this one? http://stackoverflow.com/questions/7937256/changing-text-color-in-c-sharp-console-application – KG_ Oct 03 '13 at 10:41
3 Answers
1
try this:
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("blue.");
Read more about Console.ForegroundColor
you can also change background of text: Console.BackgroundColor

Kamil Budziewski
- 22,699
- 14
- 85
- 105
1
Console.ForegroundColor = ConsoleColor.DarkRed;
Should work fine.

Kamil Budziewski
- 22,699
- 14
- 85
- 105

borkovski
- 938
- 8
- 12
-
Thanks a lot! Couldn't find that anywhere... Probably wasn't trying hard enough though. – CommonTroll Oct 03 '13 at 11:04
1
What you looking for is Console.BackgroundColor
and Console.ForegroundColor
properties.
For example;
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("This is blue!!");

Soner Gönül
- 97,193
- 102
- 206
- 364