Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Background color on C# console application [duplicate]

Ive searched the Web, but i cant seem to find the solution. I want my whole console application window to be a specific color, for example blue. How do I do that?

like image 866
user2057693 Avatar asked Feb 09 '13 21:02

user2057693


1 Answers

Simply set the background color and call Console.Clear():

class Program {
    static void Main(string[] args) {
        Console.BackgroundColor = ConsoleColor.Blue;
        Console.Clear();
        Console.ForegroundColor = ConsoleColor.White;
        Console.Write("Press any key to continue");
        Console.ReadKey();
    }
}

enter image description here

like image 136
Hans Passant Avatar answered Oct 20 '22 18:10

Hans Passant