How can I change color of a string, is this possible in C#?

I am working on the Mad Lids Game Project, which I am done with. However, I would to go beyound by changing the color of the string ‘title’, but never been able to. Can someone please give a hint? Below is string in question.

 string title = "Mad Libs Game";
  Console.WriteLine("||" + title + "||");

Yes, you can.
For example;

Console.ForegroundColor = ConsoleColor.Red;

to change the text colour, and

Console.BackgroundColor = ConsoleColor.Green;

to change the background colour.


will reset to default values.

There’s a list of available colours here;

And here’s a link for other Console functions you might want to play around with;

Hope that helps

1 Like