How to Set Console Text Background and Foreground Color


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;

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments