Changing Console Background and Foreground Colors

Changing Console Background and Foreground Colors

Changing background and foreground colors on console applications is possible.

class Program
{
    static void Main(string[] args)
    {
        Console.ForegroundColor = ConsoleColor.White;
        Console.BackgroundColor = ConsoleColor.Red;

        Console.WriteLine("Hello Vitademy");
    }
}

Console Output:

c# change console color

It's also possible to change the whole background color of command window:

static void Main(string[] args)
{
    Console.ForegroundColor = ConsoleColor.White;
    Console.BackgroundColor = ConsoleColor.Red;
    Console.Clear();

    Console.WriteLine("Hello Vitademy");
}

change console color whole screen

C# console colors list

c# console color cyan yellow