How to change the Foreground Color of Text in C# Console?
To change the Foreground Color of text, use theConsole.ForegroundColor
property in C#.Example
using System;
public class Example
{
public static void Main()
{
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine("Background color changed = "+Console.BackgroundColor);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\nForeground color changed = "+Console.ForegroundColor);
}
}