How to change the colour of text in a C# Console Application
Console Applications might be so last century with MS-DOS applications. Still, they have their uses, especially when people need a batch-processing application that doesn't require user interaction and doesn't have to be sophisticated. The Colour of the screen is always black with white writing.
If you need something to stand out, you'd probably want the text to change colour so that it stands out. Windows computers aren't terminals like you find on the old mainframe/minicomputers. They can show colour, and so can .NET console applications.
Console.ForegroundColor = ConsoleColor.Red;
Console.BackgroundColor = ConsoleColor.White;
Foregroundcolor refers to the colour of the text and background, self-explanatory. The code will set the colour of what is being written. If you need the whole screen to be White, then you clear the screen using the following command:-
Console.Clear();
Tags - Console Application
Last Modified : June 2023