NuGet.Common.Console.WriteColor C# (CSharp) Method

WriteColor() private static method

private static WriteColor ( TextWriter writer, ConsoleColor color, string value ) : void
writer System.IO.TextWriter
color ConsoleColor
value string
return void
        private static void WriteColor(TextWriter writer, ConsoleColor color, string value, params object[] args)
        {
            var currentColor = System.Console.ForegroundColor;
            try
            {
                currentColor = System.Console.ForegroundColor;
                System.Console.ForegroundColor = color;
                if (args.IsEmpty())
                {
                    // If it doesn't look like something that needs to be formatted, don't format it.
                    writer.WriteLine(value);
                }
                else
                {
                    writer.WriteLine(value, args);
                }
            }
            finally
            {
                System.Console.ForegroundColor = currentColor;
            }
        }