How to Set Console Text Background and Foreground Color

Waqas Anwar
22 December 2010
9055 Views

If you are displaying some text in Console window and you want to change the text foreground or background color. You can use the BackgroundColor and ForegroundColor properties of Console class as shown in the following code.

Console.BackgroundColor = ConsoleColor.Yellow;
Console.ForegroundColor = ConsoleColor.Red;