I have a command line program, which outputs logging to the screen.
I want error lines to show up in red. Is there some special character codes I can output to switc
You can read here a good and illustrated article: http://kpumuk.info/ruby-on-rails/colorizing-console-ruby-script-output/
I think setting console text color is pretty language-specific. Here is an example in C# from MSDN:
for (int x = 0; x < colorNames.Length; x++)
{
Console.Write("{0,2}: ", x);
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), colorNames[x]);
Console.Write("This is foreground color {0}.", colorNames[x]);
Console.ResetColor();
Console.WriteLine();
}
Console.ForegroundColor is the property for setting text color.