In a C# console application, you can change the color of the text emitted by Console.WriteLine by setting Console.ForegroundColor and Console.BackgroundColor. It’s pretty straightforward, but if you want to make the output have different colors to denote different things, its kind of cumbersome to have to set the color and then write the output, and then (probably) set the color back again…
Terminal
So I made this simple static class that adds optional parameters for the color of the resulting WriteLine or Write.
Console.WriteLine is overloaded to take all kinds of different types, but with string interpolation it is pretty trivial to just make everything a string.
Basically I’m just putting this here so I can come copy/paste it in to my next ConsoleApplicationX project when I want to have more control over the look and feel of the Console’s window. Eventually I’ll come back to it and expand on it. There’s some problems with this implementation, especially when it comes to outputting multiple Writes in different colors from different threads… but that’s another post.