set color console c# text code example
Example 1: c# change colour of console
Console.BackgroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.Clear();
Console.WriteLine("yo");
Console.ReadLine();
Example 2: c# color to console color
public static ConsoleColor FromColor(Color c)
{
int index = (c.R > 128 | c.G > 128 | c.B > 128) ? 8 : 0;
index |= (c.R > 64) ? 4 : 0;
index |= (c.G > 64) ? 2 : 0;
index |= (c.B > 64) ? 1 : 0;
return (System.ConsoleColor)index;
}