585 references to ConsoleColor
aspire (43)
Commands\LogsCommand.cs (2)
257var logParser = new LogParser(ConsoleColor.Black); 298var logParser = new LogParser(ConsoleColor.Black);
Mcp\Tools\ListConsoleLogsTool.cs (1)
64var logParser = new LogParser(ConsoleColor.Black);
src\Shared\ConsoleLogs\AnsiParser.cs (38)
67public static ConversionResult ConvertToHtml(string? text, ParserState? priorResidualState = null, ConsoleColor? defaultBackgroundColor = null) 200private static void ProcessParameters(ConsoleColor? defaultBackgroundColor, ref ParserState newState, int[] parameters) 521ConsoleColor.Black => state.Bright ? "ansi-fg-brightblack" : "ansi-fg-black", 522ConsoleColor.Blue => state.Bright ? "ansi-fg-brightblue" : "ansi-fg-blue", 523ConsoleColor.Cyan => state.Bright ? "ansi-fg-brightcyan" : "ansi-fg-cyan", 524ConsoleColor.Green => state.Bright ? "ansi-fg-brightgreen" : "ansi-fg-green", 525ConsoleColor.Magenta => state.Bright ? "ansi-fg-brightmagenta" : "ansi-fg-magenta", 526ConsoleColor.Red => state.Bright ? "ansi-fg-brightred" : "ansi-fg-red", 527ConsoleColor.White => state.Bright ? "ansi-fg-brightwhite" : "ansi-fg-white", 528ConsoleColor.Yellow => state.Bright ? "ansi-fg-brightyellow" : "ansi-fg-yellow", 537ConsoleColor.Black => "ansi-bg-black", 538ConsoleColor.Blue => "ansi-bg-blue", 539ConsoleColor.Cyan => "ansi-bg-cyan", 540ConsoleColor.Green => "ansi-bg-green", 541ConsoleColor.Magenta => "ansi-bg-magenta", 542ConsoleColor.Red => "ansi-bg-red", 543ConsoleColor.White => "ansi-bg-white", 544ConsoleColor.Yellow => "ansi-bg-yellow", 549private static bool TryGetForegroundColor(int number, out ConsoleColor? color) 55330 => ConsoleColor.Black, 55431 => ConsoleColor.Red, 55532 => ConsoleColor.Green, 55633 => ConsoleColor.Yellow, 55734 => ConsoleColor.Blue, 55835 => ConsoleColor.Magenta, 55936 => ConsoleColor.Cyan, 56037 => ConsoleColor.White, 566private static bool TryGetBackgroundColor(int number, out ConsoleColor? color) 57040 => ConsoleColor.Black, 57141 => ConsoleColor.Red, 57242 => ConsoleColor.Green, 57343 => ConsoleColor.Yellow, 57444 => ConsoleColor.Blue, 57545 => ConsoleColor.Magenta, 57646 => ConsoleColor.Cyan, 57747 => ConsoleColor.White, 863public ConsoleColor? ForegroundColor { get; set; } 864public ConsoleColor? BackgroundColor { get; set; }
src\Shared\ConsoleLogs\LogParser.cs (2)
10private readonly ConsoleColor _defaultBackgroundColor; 14public LogParser(ConsoleColor defaultBackgroundColor, bool encodeForHtml = false)
Aspire.Dashboard (44)
Components\Pages\ConsoleLogs.razor.cs (1)
782var logParser = new LogParser(ConsoleColor.Black, encodeForHtml: true);
Mcp\AspireResourceMcpTools.cs (1)
94var logParser = new LogParser(ConsoleColor.Black, encodeForHtml: true);
Model\Assistant\AssistantChatDataContext.cs (1)
252var logParser = new LogParser(ConsoleColor.Black);
Model\ConsoleLogsFetcher.cs (1)
32var logParser = new LogParser(ConsoleColor.Black);
src\Shared\ConsoleLogs\AnsiParser.cs (38)
67public static ConversionResult ConvertToHtml(string? text, ParserState? priorResidualState = null, ConsoleColor? defaultBackgroundColor = null) 200private static void ProcessParameters(ConsoleColor? defaultBackgroundColor, ref ParserState newState, int[] parameters) 521ConsoleColor.Black => state.Bright ? "ansi-fg-brightblack" : "ansi-fg-black", 522ConsoleColor.Blue => state.Bright ? "ansi-fg-brightblue" : "ansi-fg-blue", 523ConsoleColor.Cyan => state.Bright ? "ansi-fg-brightcyan" : "ansi-fg-cyan", 524ConsoleColor.Green => state.Bright ? "ansi-fg-brightgreen" : "ansi-fg-green", 525ConsoleColor.Magenta => state.Bright ? "ansi-fg-brightmagenta" : "ansi-fg-magenta", 526ConsoleColor.Red => state.Bright ? "ansi-fg-brightred" : "ansi-fg-red", 527ConsoleColor.White => state.Bright ? "ansi-fg-brightwhite" : "ansi-fg-white", 528ConsoleColor.Yellow => state.Bright ? "ansi-fg-brightyellow" : "ansi-fg-yellow", 537ConsoleColor.Black => "ansi-bg-black", 538ConsoleColor.Blue => "ansi-bg-blue", 539ConsoleColor.Cyan => "ansi-bg-cyan", 540ConsoleColor.Green => "ansi-bg-green", 541ConsoleColor.Magenta => "ansi-bg-magenta", 542ConsoleColor.Red => "ansi-bg-red", 543ConsoleColor.White => "ansi-bg-white", 544ConsoleColor.Yellow => "ansi-bg-yellow", 549private static bool TryGetForegroundColor(int number, out ConsoleColor? color) 55330 => ConsoleColor.Black, 55431 => ConsoleColor.Red, 55532 => ConsoleColor.Green, 55633 => ConsoleColor.Yellow, 55734 => ConsoleColor.Blue, 55835 => ConsoleColor.Magenta, 55936 => ConsoleColor.Cyan, 56037 => ConsoleColor.White, 566private static bool TryGetBackgroundColor(int number, out ConsoleColor? color) 57040 => ConsoleColor.Black, 57141 => ConsoleColor.Red, 57242 => ConsoleColor.Green, 57343 => ConsoleColor.Yellow, 57444 => ConsoleColor.Blue, 57545 => ConsoleColor.Magenta, 57646 => ConsoleColor.Cyan, 57747 => ConsoleColor.White, 863public ConsoleColor? ForegroundColor { get; set; } 864public ConsoleColor? BackgroundColor { get; set; }
src\Shared\ConsoleLogs\LogParser.cs (2)
10private readonly ConsoleColor _defaultBackgroundColor; 14public LogParser(ConsoleColor defaultBackgroundColor, bool encodeForHtml = false)
Aspire.Dashboard.Tests (14)
ConsoleLogsTests\AnsiParserTests.cs (8)
65var expectedResidualState = new AnsiParser.ParserState() { ForegroundColor = ConsoleColor.Green }; 149Assert.Equal(new AnsiParser.ParserState() { ForegroundColor = ConsoleColor.Green }, result1.ResidualState); 165Assert.Equal(new AnsiParser.ParserState() { ForegroundColor = ConsoleColor.Green, BackgroundColor = ConsoleColor.Green }, result1.ResidualState); 217var expectedResidualState = new AnsiParser.ParserState() { ForegroundColor = ConsoleColor.Green, BackgroundColor = ConsoleColor.Green }; 229var expectedResidualState = new AnsiParser.ParserState() { Bright = true, BackgroundColor = ConsoleColor.Green }; 241var expectedResidualState = new AnsiParser.ParserState() { Bright = true, ForegroundColor = ConsoleColor.Green };
ConsoleLogsTests\LogEntriesTests.cs (6)
20var logParser = new LogParser(ConsoleColor.Black, encodeForHtml: true); 32var logParser = new LogParser(ConsoleColor.Black, encodeForHtml: true); 299var parser = new LogParser(ConsoleColor.Black, encodeForHtml: true); 309[InlineData(ConsoleColor.Black, @"<span class=""ansi-fg-green"">info</span>: LoggerName")] 310[InlineData(ConsoleColor.Blue, @"<span class=""ansi-fg-green ansi-bg-black"">info</span>: LoggerName")] 311public void CreateLogEntry_DefaultBackgroundColor_SkipMatchingColor(ConsoleColor defaultBackgroundColor, string output)
dotnet (45)
Commands\Test\MTP\Terminal\IConsole.cs (4)
19void SetForegroundColor(ConsoleColor color); 21void SetBackgroundColor(ConsoleColor color); 23ConsoleColor GetForegroundColor(); 25ConsoleColor GetBackgroundColor();
Commands\Test\MTP\Terminal\NonAnsiTerminal.cs (19)
14private readonly ConsoleColor _defaultForegroundColor; 19=> _defaultForegroundColor = IsForegroundColorNotSupported() ? ConsoleColor.Black : console.GetForegroundColor(); 52private ConsoleColor ToConsoleColor(TerminalColor color) => color switch 54TerminalColor.Black => ConsoleColor.Black, 55TerminalColor.DarkRed => ConsoleColor.DarkRed, 56TerminalColor.DarkGreen => ConsoleColor.DarkGreen, 57TerminalColor.DarkYellow => ConsoleColor.DarkYellow, 58TerminalColor.DarkBlue => ConsoleColor.DarkBlue, 59TerminalColor.DarkMagenta => ConsoleColor.DarkMagenta, 60TerminalColor.DarkCyan => ConsoleColor.DarkCyan, 61TerminalColor.Gray => ConsoleColor.White, 63TerminalColor.DarkGray => ConsoleColor.Gray, 64TerminalColor.Red => ConsoleColor.Red, 65TerminalColor.Green => ConsoleColor.Green, 66TerminalColor.Yellow => ConsoleColor.Yellow, 67TerminalColor.Blue => ConsoleColor.Blue, 68TerminalColor.Magenta => ConsoleColor.Magenta, 69TerminalColor.Cyan => ConsoleColor.Cyan, 70TerminalColor.White => ConsoleColor.White,
Commands\Test\MTP\Terminal\SystemConsole.cs (4)
95public void SetForegroundColor(ConsoleColor color) 98public void SetBackgroundColor(ConsoleColor color) 101public ConsoleColor GetForegroundColor() 104public ConsoleColor GetBackgroundColor()
Commands\Test\MTP\Terminal\SystemConsoleColor.cs (1)
14public ConsoleColor ConsoleColor { get; init; }
Commands\Test\MTP\Terminal\TerminalTestReporter.cs (17)
930private static TerminalColor ToTerminalColor(ConsoleColor consoleColor) 933ConsoleColor.Black => TerminalColor.Black, 934ConsoleColor.DarkBlue => TerminalColor.DarkBlue, 935ConsoleColor.DarkGreen => TerminalColor.DarkGreen, 936ConsoleColor.DarkCyan => TerminalColor.DarkCyan, 937ConsoleColor.DarkRed => TerminalColor.DarkRed, 938ConsoleColor.DarkMagenta => TerminalColor.DarkMagenta, 939ConsoleColor.DarkYellow => TerminalColor.DarkYellow, 940ConsoleColor.DarkGray => TerminalColor.DarkGray, 941ConsoleColor.Gray => TerminalColor.Gray, 942ConsoleColor.Blue => TerminalColor.Blue, 943ConsoleColor.Green => TerminalColor.Green, 944ConsoleColor.Cyan => TerminalColor.Cyan, 945ConsoleColor.Red => TerminalColor.Red, 946ConsoleColor.Magenta => TerminalColor.Magenta, 947ConsoleColor.Yellow => TerminalColor.Yellow, 948ConsoleColor.White => TerminalColor.White,
dotnet-dev-certs (18)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (12)
37public ConsoleColor OriginalForegroundColor { get; } 39private static void SetColor(ConsoleColor color) 41Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07)); 52Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08); 110SetColor(ConsoleColor.Black); 113SetColor(ConsoleColor.Red); 116SetColor(ConsoleColor.Green); 119SetColor(ConsoleColor.Yellow); 122SetColor(ConsoleColor.Blue); 125SetColor(ConsoleColor.Magenta); 128SetColor(ConsoleColor.Cyan); 131SetColor(ConsoleColor.Gray);
src\aspnetcore\src\Tools\Shared\CommandLine\ConsoleReporter.cs (4)
34protected virtual void WriteLine(TextWriter writer, string message, ConsoleColor? color) 53=> WriteLine(Console.Error, message, ConsoleColor.Red); 55=> WriteLine(Console.Out, message, ConsoleColor.Yellow); 73WriteLine(Console.Out, message, ConsoleColor.DarkGray);
src\aspnetcore\src\Tools\Shared\CommandLine\IConsole.cs (1)
22ConsoleColor ForegroundColor { get; set; }
src\aspnetcore\src\Tools\Shared\CommandLine\PhysicalConsole.cs (1)
32public ConsoleColor ForegroundColor
dotnet-format (9)
Logging\SimpleConsoleLogger.cs (9)
20private static ImmutableDictionary<LogLevel, ConsoleColor> LogLevelColorMap => new Dictionary<LogLevel, ConsoleColor> 22[LogLevel.Critical] = ConsoleColor.Red, 23[LogLevel.Error] = ConsoleColor.Red, 24[LogLevel.Warning] = ConsoleColor.Yellow, 25[LogLevel.Information] = ConsoleColor.White, 26[LogLevel.Debug] = ConsoleColor.Gray, 27[LogLevel.Trace] = ConsoleColor.Gray, 28[LogLevel.None] = ConsoleColor.White,
dotnet-svcutil-lib (3)
ToolConsole.cs (3)
138var originalColor = Console.ForegroundColor; 141Console.ForegroundColor = ConsoleColor.Yellow; 147Console.ForegroundColor = ConsoleColor.Red;
dotnet-user-jwts (18)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (12)
37public ConsoleColor OriginalForegroundColor { get; } 39private static void SetColor(ConsoleColor color) 41Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07)); 52Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08); 110SetColor(ConsoleColor.Black); 113SetColor(ConsoleColor.Red); 116SetColor(ConsoleColor.Green); 119SetColor(ConsoleColor.Yellow); 122SetColor(ConsoleColor.Blue); 125SetColor(ConsoleColor.Magenta); 128SetColor(ConsoleColor.Cyan); 131SetColor(ConsoleColor.Gray);
src\aspnetcore\src\Tools\Shared\CommandLine\ConsoleReporter.cs (4)
34protected virtual void WriteLine(TextWriter writer, string message, ConsoleColor? color) 53=> WriteLine(Console.Error, message, ConsoleColor.Red); 55=> WriteLine(Console.Out, message, ConsoleColor.Yellow); 73WriteLine(Console.Out, message, ConsoleColor.DarkGray);
src\aspnetcore\src\Tools\Shared\CommandLine\IConsole.cs (1)
22ConsoleColor ForegroundColor { get; set; }
src\aspnetcore\src\Tools\Shared\CommandLine\PhysicalConsole.cs (1)
32public ConsoleColor ForegroundColor
dotnet-user-secrets (18)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (12)
37public ConsoleColor OriginalForegroundColor { get; } 39private static void SetColor(ConsoleColor color) 41Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07)); 52Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08); 110SetColor(ConsoleColor.Black); 113SetColor(ConsoleColor.Red); 116SetColor(ConsoleColor.Green); 119SetColor(ConsoleColor.Yellow); 122SetColor(ConsoleColor.Blue); 125SetColor(ConsoleColor.Magenta); 128SetColor(ConsoleColor.Cyan); 131SetColor(ConsoleColor.Gray);
src\aspnetcore\src\Tools\Shared\CommandLine\ConsoleReporter.cs (4)
34protected virtual void WriteLine(TextWriter writer, string message, ConsoleColor? color) 53=> WriteLine(Console.Error, message, ConsoleColor.Red); 55=> WriteLine(Console.Out, message, ConsoleColor.Yellow); 73WriteLine(Console.Out, message, ConsoleColor.DarkGray);
src\aspnetcore\src\Tools\Shared\CommandLine\IConsole.cs (1)
22ConsoleColor ForegroundColor { get; set; }
src\aspnetcore\src\Tools\Shared\CommandLine\PhysicalConsole.cs (1)
32public ConsoleColor ForegroundColor
ilasm (1)
IlasmRootCommand.cs (1)
177Console.ForegroundColor = ConsoleColor.Red;
Microsoft.Arcade.Common (41)
CompactConsoleLoggerFormatter.cs (41)
115private (ConsoleColor? Foreground, ConsoleColor? Background) GetLogLevelConsoleColors(LogLevel logLevel) 126LogLevel.Trace => (ConsoleColor.Gray, ConsoleColor.Black), 127LogLevel.Debug => (ConsoleColor.Gray, ConsoleColor.Black), 128LogLevel.Information => (ConsoleColor.DarkGreen, ConsoleColor.Black), 129LogLevel.Warning => (ConsoleColor.Yellow, ConsoleColor.Black), 130LogLevel.Error => (ConsoleColor.Black, ConsoleColor.DarkRed), 131LogLevel.Critical => (ConsoleColor.White, ConsoleColor.DarkRed), 136private static void WriteColoredMessage(TextWriter textWriter, string message, ConsoleColor? background, ConsoleColor? foreground) 162private static string GetForegroundColorEscapeCode(ConsoleColor color) => color switch 164ConsoleColor.Black => "\x1B[30m", 165ConsoleColor.DarkRed => "\x1B[31m", 166ConsoleColor.DarkGreen => "\x1B[32m", 167ConsoleColor.DarkYellow => "\x1B[33m", 168ConsoleColor.DarkBlue => "\x1B[34m", 169ConsoleColor.DarkMagenta => "\x1B[35m", 170ConsoleColor.DarkCyan => "\x1B[36m", 171ConsoleColor.Gray => "\x1B[37m", 172ConsoleColor.Red => "\x1B[1m\x1B[31m", 173ConsoleColor.Green => "\x1B[1m\x1B[32m", 174ConsoleColor.Yellow => "\x1B[1m\x1B[33m", 175ConsoleColor.Blue => "\x1B[1m\x1B[34m", 176ConsoleColor.Magenta => "\x1B[1m\x1B[35m", 177ConsoleColor.Cyan => "\x1B[1m\x1B[36m", 178ConsoleColor.White => "\x1B[1m\x1B[37m", 182private static string GetBackgroundColorEscapeCode(ConsoleColor color) => color switch 184ConsoleColor.Black => "\x1B[40m", 185ConsoleColor.DarkRed => "\x1B[41m", 186ConsoleColor.DarkGreen => "\x1B[42m", 187ConsoleColor.DarkYellow => "\x1B[43m", 188ConsoleColor.DarkBlue => "\x1B[44m", 189ConsoleColor.DarkMagenta => "\x1B[45m", 190ConsoleColor.DarkCyan => "\x1B[46m", 191ConsoleColor.Gray => "\x1B[47m",
Microsoft.Build (83)
BackEnd\Client\MSBuildClient.cs (4)
369ConsoleColor backgroundColor = QueryConsoleBackgroundColor(); 396private ConsoleColor QueryConsoleBackgroundColor() 398ConsoleColor consoleBackgroundColor; 405consoleBackgroundColor = ConsoleColor.Black;
Logging\BaseConsoleLogger.cs (44)
185setColor(ConsoleColor.Green); 189setColor(ConsoleColor.Gray); 196setColor(ConsoleColor.Green); 200setColor(ConsoleColor.Gray); 207setColor(ConsoleColor.Green); 211setColor(ConsoleColor.Gray); 218setColor(ConsoleColor.Green); 222setColor(ConsoleColor.Gray); 304internal static void SetColor(ConsoleColor c) 335internal static void SetColorAnsi(ConsoleColor c) 340case ConsoleColor.Black: colorString += "30"; break; 341case ConsoleColor.DarkBlue: colorString += "34"; break; 342case ConsoleColor.DarkGreen: colorString += "32"; break; 343case ConsoleColor.DarkCyan: colorString += "36"; break; 344case ConsoleColor.DarkRed: colorString += "31"; break; 345case ConsoleColor.DarkMagenta: colorString += "35"; break; 346case ConsoleColor.DarkYellow: colorString += "33"; break; 347case ConsoleColor.Gray: colorString += "37"; break; 348case ConsoleColor.DarkGray: colorString += "30;1"; break; 349case ConsoleColor.Blue: colorString += "34;1"; break; 350case ConsoleColor.Green: colorString += "32;1"; break; 351case ConsoleColor.Cyan: colorString += "36;1"; break; 352case ConsoleColor.Red: colorString += "31;1"; break; 353case ConsoleColor.Magenta: colorString += "35;1"; break; 354case ConsoleColor.Yellow: colorString += "33;1"; break; 355case ConsoleColor.White: colorString += "37;1"; break; 380internal static ConsoleColor TransformColor(ConsoleColor foreground, ConsoleColor background) 382ConsoleColor result = foreground; // typically do nothing ... 386result = background != ConsoleColor.Black ? ConsoleColor.Black : ConsoleColor.Gray; 396internal static void DontSetColor(ConsoleColor c) 421ConsoleColor c = ConsoleConfiguration.BackgroundColor; 512setColor(ConsoleColor.Green); 520setColor(ConsoleColor.Gray); 522setColor(ConsoleColor.DarkGray); 533setColor(ConsoleColor.Green); 538setColor(ConsoleColor.Gray); 540setColor(ConsoleColor.DarkGray); 560setColor(ConsoleColor.Green); 652setColor(ConsoleColor.Gray); 654setColor(ConsoleColor.DarkGray);
Logging\ConsoleConfiguration.cs (1)
55public static ConsoleColor BackgroundColor => Provider.BackgroundColor;
Logging\ConsoleLogger.cs (1)
30public delegate void ColorSetter(ConsoleColor color);
Logging\IConsoleConfiguration.cs (1)
39ConsoleColor BackgroundColor { get; }
Logging\InProcessConsoleConfiguration.cs (2)
60public ConsoleColor BackgroundColor 76return ConsoleColor.Black;
Logging\ParallelLogger\ParallelConsoleLogger.cs (27)
282setColor(ConsoleColor.Green); 312setColor(ConsoleColor.Yellow); 319setColor(ConsoleColor.Red); 367setColor(ConsoleColor.Yellow); 376setColor(ConsoleColor.Red); 408setColor(ConsoleColor.Yellow); 414setColor(ConsoleColor.Red); 677setColor(ConsoleColor.Cyan); 757setColor(ConsoleColor.Green); 762setColor(ConsoleColor.Gray); 775setColor(ConsoleColor.Green); 783setColor(ConsoleColor.Gray); 823setColor(ConsoleColor.DarkGray); 825setColor(ConsoleColor.Gray); 911setColor(ConsoleColor.Cyan); 949setColor(ConsoleColor.DarkCyan); 993setColor(ConsoleColor.DarkCyan); 1056setColor(ConsoleColor.Red); 1102setColor(ConsoleColor.Yellow); 1277setColor(ConsoleColor.DarkGray); 1340setColor(ConsoleColor.Cyan); 1352setColor(ConsoleColor.DarkGray); 1429setColor(ConsoleColor.Cyan); 1517setColor(ConsoleColor.Cyan); 1534setColor(ConsoleColor.Cyan); 1594setColor(ConsoleColor.Cyan); 1759setColor(ConsoleColor.White);
Logging\TargetConsoleConfiguration.cs (3)
17private ConsoleColor _backgroundColor; 19public TargetConsoleConfiguration(int bufferWidth, bool acceptAnsiColorCodes, bool outputIsScreen, ConsoleColor backgroundColor) 40public ConsoleColor BackgroundColor => _backgroundColor;
Microsoft.CodeAnalysis.Scripting (5)
Hosting\CommandLine\CommandLineRunner.cs (4)
346Console.SetForegroundColor(ConsoleColor.Red); 391Console.SetForegroundColor(diagnostic.Severity == DiagnosticSeverity.Error ? ConsoleColor.Red : ConsoleColor.Yellow); 398Console.SetForegroundColor(ConsoleColor.DarkRed);
Hosting\CommandLine\ConsoleIO.cs (1)
31public virtual void SetForegroundColor(ConsoleColor consoleColor) => Console.ForegroundColor = consoleColor;
Microsoft.DotNet.Cli.Utils (12)
AnsiConsole.cs (12)
35public ConsoleColor OriginalForegroundColor { get; } 37private void SetColor(ConsoleColor color) 48_boldRecursion > 0 ? (ConsoleColor)(c | Light) : // ensure color is light 49(ConsoleColor)(c & ~Light); // ensure color is dark 119SetColor(ConsoleColor.Black); 122SetColor(ConsoleColor.Red); 125SetColor(ConsoleColor.Green); 128SetColor(ConsoleColor.Yellow); 131SetColor(ConsoleColor.Blue); 134SetColor(ConsoleColor.Magenta); 137SetColor(ConsoleColor.Cyan); 140SetColor(ConsoleColor.Gray);
Microsoft.DotNet.HotReload.Watch (12)
UI\ConsoleInputReader.cs (4)
31console.ForegroundColor = ConsoleColor.DarkGray; 59WriteLine(keyDisplay, ConsoleColor.DarkRed); 87void WriteLine(string message, ConsoleColor color = ConsoleColor.DarkGray)
UI\ConsoleReporter.cs (6)
23private void WriteLine(TextWriter writer, string message, ConsoleColor? color, Emoji emoji) 27console.ForegroundColor = ConsoleColor.DarkGray; 49LogLevel.Critical or LogLevel.Error => ConsoleColor.Red, 50LogLevel.Warning => ConsoleColor.Yellow, 51LogLevel.Information => (ConsoleColor?)null, 52_ => ConsoleColor.DarkGray,
UI\IConsole.cs (1)
11ConsoleColor ForegroundColor { get; set; }
UI\PhysicalConsole.cs (1)
129public ConsoleColor ForegroundColor
Microsoft.DotNet.VersionTools.Cli (2)
ConsoleLogger.cs (2)
17var fgColor = Console.ForegroundColor; 18Console.ForegroundColor = ConsoleColor.Red;
Microsoft.Extensions.DotNetDeltaApplier (1)
src\sdk\src\Dotnet.Watch\HotReloadAgent.Host\StartupHook.cs (1)
169Console.ForegroundColor = ConsoleColor.DarkGray;
Microsoft.Extensions.Logging.Console (81)
AnsiParser.cs (57)
12private readonly Action<string, int, int, ConsoleColor?, ConsoleColor?> _onParseWrite; 13public AnsiParser(Action<string, int, int, ConsoleColor?, ConsoleColor?> onParseWrite) 50ConsoleColor? foreground = null; 51ConsoleColor? background = null; 54ConsoleColor? color = null; 133internal static string GetForegroundColorEscapeCode(ConsoleColor color) 137ConsoleColor.Black => "\e[30m", 138ConsoleColor.DarkRed => "\e[31m", 139ConsoleColor.DarkGreen => "\e[32m", 140ConsoleColor.DarkYellow => "\e[33m", 141ConsoleColor.DarkBlue => "\e[34m", 142ConsoleColor.DarkMagenta => "\e[35m", 143ConsoleColor.DarkCyan => "\e[36m", 144ConsoleColor.Gray => "\e[37m", 145ConsoleColor.Red => "\e[1m\e[31m", 146ConsoleColor.Green => "\e[1m\e[32m", 147ConsoleColor.Yellow => "\e[1m\e[33m", 148ConsoleColor.Blue => "\e[1m\e[34m", 149ConsoleColor.Magenta => "\e[1m\e[35m", 150ConsoleColor.Cyan => "\e[1m\e[36m", 151ConsoleColor.White => "\e[1m\e[37m", 156internal static string GetBackgroundColorEscapeCode(ConsoleColor color) 160ConsoleColor.Black => "\e[40m", 161ConsoleColor.DarkRed => "\e[41m", 162ConsoleColor.DarkGreen => "\e[42m", 163ConsoleColor.DarkYellow => "\e[43m", 164ConsoleColor.DarkBlue => "\e[44m", 165ConsoleColor.DarkMagenta => "\e[45m", 166ConsoleColor.DarkCyan => "\e[46m", 167ConsoleColor.Gray => "\e[47m", 172private static bool TryGetForegroundColor(int number, bool isBright, out ConsoleColor? color) 17630 => ConsoleColor.Black, 17731 => isBright ? ConsoleColor.Red : ConsoleColor.DarkRed, 17832 => isBright ? ConsoleColor.Green : ConsoleColor.DarkGreen, 17933 => isBright ? ConsoleColor.Yellow : ConsoleColor.DarkYellow, 18034 => isBright ? ConsoleColor.Blue : ConsoleColor.DarkBlue, 18135 => isBright ? ConsoleColor.Magenta : ConsoleColor.DarkMagenta, 18236 => isBright ? ConsoleColor.Cyan : ConsoleColor.DarkCyan, 18337 => isBright ? ConsoleColor.White : ConsoleColor.Gray, 189private static bool TryGetBackgroundColor(int number, out ConsoleColor? color) 19340 => ConsoleColor.Black, 19441 => ConsoleColor.DarkRed, 19542 => ConsoleColor.DarkGreen, 19643 => ConsoleColor.DarkYellow, 19744 => ConsoleColor.DarkBlue, 19845 => ConsoleColor.DarkMagenta, 19946 => ConsoleColor.DarkCyan, 20047 => ConsoleColor.Gray,
AnsiParsingLogConsole.cs (6)
30private static bool SetColor(ConsoleColor? background, ConsoleColor? foreground) 36private static bool SetBackgroundColor(ConsoleColor? background) 46private static bool SetForegroundColor(ConsoleColor? foreground) 61private void WriteToConsole(string message, int startIndex, int length, ConsoleColor? background, ConsoleColor? foreground)
SimpleConsoleFormatter.cs (16)
191LogLevel.Trace => new ConsoleColors(ConsoleColor.Gray, ConsoleColor.Black), 192LogLevel.Debug => new ConsoleColors(ConsoleColor.Gray, ConsoleColor.Black), 193LogLevel.Information => new ConsoleColors(ConsoleColor.DarkGreen, ConsoleColor.Black), 194LogLevel.Warning => new ConsoleColors(ConsoleColor.Yellow, ConsoleColor.Black), 195LogLevel.Error => new ConsoleColors(ConsoleColor.Black, ConsoleColor.DarkRed), 196LogLevel.Critical => new ConsoleColors(ConsoleColor.White, ConsoleColor.DarkRed), 230public ConsoleColors(ConsoleColor? foreground, ConsoleColor? background) 236public ConsoleColor? Foreground { get; } 238public ConsoleColor? Background { get; }
TextWriterExtensions.cs (2)
11public static void WriteColoredMessage(this TextWriter textWriter, string message, ConsoleColor? background, ConsoleColor? foreground)
Microsoft.ML.Core (5)
Environment\ConsoleEnvironment.cs (5)
58var messageColor = default(ConsoleColor); 65messageColor = ConsoleColor.Gray; 70messageColor = ConsoleColor.Yellow; 75messageColor = ConsoleColor.Red;
Microsoft.TestPlatform.CoreUtilities (6)
Output\OutputExtensions.cs (6)
28SetColorForAction(ConsoleColor.Red, () => Output(output, OutputLevel.Error, appendPrefix ? Resources.CommandLineError : DefaultFormat, format, args)); 40SetColorForAction(ConsoleColor.Yellow, () => Output(output, OutputLevel.Warning, appendPrefix ? Resources.CommandLineWarning : DefaultFormat, format, args)); 63public static void Information(this IOutput output, bool appendPrefix, ConsoleColor foregroundColor, string format, params object?[]? args) 75public static void Write(this IOutput output, string message, OutputLevel level, ConsoleColor foregroundColor) 112private static void SetColorForAction(ConsoleColor foregroundColor, Action action) 128var previousForegroundColor = Console.ForegroundColor;
Microsoft.TestPlatform.CrossPlatEngine (2)
PostProcessing\PostProcessingTestRunAttachmentsProcessingEventsHandler.cs (2)
63_consoleOutput.Information(false, ConsoleColor.Gray, CommandLineResources.AttachmentsBanner); 68_consoleOutput.Information(false, ConsoleColor.Gray, CommandLineResources.AttachmentOutputFormat, uriDataAttachment.Uri.LocalPath);
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
130[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ConsoleColor))]
netstandard (1)
netstandard.cs (1)
434[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ConsoleColor))]
NuGet.CommandLine.XPlat (46)
Commands\DeleteCommand.cs (3)
99ConsoleColor currentColor = ConsoleColor.Gray; 103Console.ForegroundColor = ConsoleColor.Yellow;
Commands\Package\Update\PackageUpdateCommandRunner.cs (14)
65ConsoleColor.Red); 95logger.LogMinimal(Strings.PackageUpdate_PreviewRestoreFailed, ConsoleColor.Red); 122logger.LogMinimal(Format.PackageUpdate_FinalSummary(uniquePackageCount, totalPackagesScanned), ConsoleColor.Green); 201logger.LogMinimal(Format.PackageUpdate_AllVersionsHaveAdvisories(packageIdentity.Id), ConsoleColor.Yellow); 337logger.LogMinimal(Strings.PackageUpdate_NoVulnerablePackages, ConsoleColor.Green); 342logger.LogMinimal(Strings.PackageUpdate_AlreadyUpToDate, ConsoleColor.Green); 436logger.LogMinimal(Messages.Warning_AlreadyUsingSameVersion(package.Id, upgradeVersion.OriginalString!), ConsoleColor.Yellow); 446logger.LogMinimal(Messages.Error_NoVersionsAvailable(package.Id), ConsoleColor.Red); 454logger.LogMinimal(Messages.Warning_AlreadyHighestVersion(package.Id, latestVersion.OriginalVersion!, project.FilePath), ConsoleColor.Yellow); 506ConsoleColor.Red); 519ConsoleColor.Red); 539ConsoleColor.Red); 584logger.LogMinimal(Messages.Error_NoVersionsAvailable(package.identity.Id), ConsoleColor.Red); 634ConsoleColor.Red);
Commands\PackageSearch\Table.cs (4)
33private ConsoleColor _highlighter = ConsoleColor.Red; 37private readonly ConsoleColor _consoleColor = Console.ForegroundColor; 114ConsoleColor color = _consoleColor;
ListPackage\ListPackageConsoleRenderer.cs (2)
148Console.ForegroundColor = ConsoleColor.Blue; 171Console.ForegroundColor = ConsoleColor.Blue;
src\nuget-client\artifacts\.packages\microsoft.extensions.commandlineutils.sources\3.0.0-preview6.19253.5\contentFiles\cs\netstandard1.0\shared\CommandLine\AnsiConsole.cs (12)
37public ConsoleColor OriginalForegroundColor { get; } 39private void SetColor(ConsoleColor color) 41Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07)); 52Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08); 106SetColor(ConsoleColor.Black); 109SetColor(ConsoleColor.Red); 112SetColor(ConsoleColor.Green); 115SetColor(ConsoleColor.Yellow); 118SetColor(ConsoleColor.Blue); 121SetColor(ConsoleColor.Magenta); 124SetColor(ConsoleColor.Cyan); 127SetColor(ConsoleColor.Gray);
Utility\CommandOutputLogger.cs (4)
144public virtual void LogMinimal(string data, ConsoleColor color) 146var currentColor = Console.ForegroundColor; 152public void LogInline(string data, ConsoleColor color) 154var currentColor = Console.ForegroundColor;
Utility\FormattedCell.cs (2)
14public ConsoleColor? ForegroundColor { get; set; } 18public FormattedCell(string value, ConsoleColor? foregroundColor = null)
Utility\ILoggerWithColor.cs (2)
18void LogMinimal(string data, ConsoleColor color); 26void LogInline(string data, ConsoleColor color);
Utility\ProjectPackagesPrintUtility.cs (3)
194case 1: return new FormattedCell("Moderate", foregroundColor: ConsoleColor.Yellow); 195case 2: return new FormattedCell("High", foregroundColor: ConsoleColor.Red); 196case 3: return new FormattedCell("Critical", foregroundColor: ConsoleColor.Red);
rzc (12)
CommandLine\AnsiConsole.cs (12)
34public ConsoleColor OriginalForegroundColor { get; } 36private void SetColor(ConsoleColor color) 38Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07)); 49Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08); 103SetColor(ConsoleColor.Black); 106SetColor(ConsoleColor.Red); 109SetColor(ConsoleColor.Green); 112SetColor(ConsoleColor.Yellow); 115SetColor(ConsoleColor.Blue); 118SetColor(ConsoleColor.Magenta); 121SetColor(ConsoleColor.Cyan); 124SetColor(ConsoleColor.Gray);
SuperFileCheck (9)
Program.cs (9)
497Console.ForegroundColor = ConsoleColor.Red; 507Console.ForegroundColor = ConsoleColor.Red; 517Console.ForegroundColor = ConsoleColor.Red; 528Console.ForegroundColor = ConsoleColor.Red; 542Console.ForegroundColor = ConsoleColor.Red; 665Console.ForegroundColor = ConsoleColor.Red; 741Console.ForegroundColor = ConsoleColor.Red; 756Console.ForegroundColor = ConsoleColor.Red; 772Console.ForegroundColor = ConsoleColor.Red;
System.CommandLine (1)
ConsoleHelpers.cs (1)
27Console.ForegroundColor = ConsoleColor.Red;
System.Console (16)
System\Console.cs (7)
323internal const ConsoleColor UnknownColor = (ConsoleColor)(-1); 329public static ConsoleColor BackgroundColor 339public static ConsoleColor ForegroundColor 529ConsolePal.MoveBufferArea(sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop, ' ', ConsoleColor.Black, BackgroundColor); 533public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
System\ConsolePal.Unix.cs (9)
164private static ConsoleColor s_trackedForegroundColor = Console.UnknownColor; 165private static ConsoleColor s_trackedBackgroundColor = Console.UnknownColor; 167public static ConsoleColor ForegroundColor 173public static ConsoleColor BackgroundColor 722public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor) 757private static void RefreshColors(ref ConsoleColor toChange, ConsoleColor value) 785private static void WriteSetColorString(bool foreground, ConsoleColor color)
vstest.console (18)
Internal\ConsoleLogger.cs (18)
304Output.Information(false, ConsoleColor.Red, TestResultPrefix + CommandLineResources.ErrorMessageBanner); 306Output.Information(false, ConsoleColor.Red, errorMessage); 312Output.Information(false, ConsoleColor.Red, TestResultPrefix + CommandLineResources.StacktraceBanner); 314Output.Information(false, ConsoleColor.Red, stackTrace); 338Output.Information(false, ConsoleColor.Red, TestResultPrefix + CommandLineResources.StdErrMessagesBanner); 339Output.Information(false, ConsoleColor.Red, stdErrMessages); 547Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information, ConsoleColor.Yellow); 570Output.Write(GetFormattedTestIndicator(CommandLineResources.FailedTestIndicator), OutputLevel.Information, ConsoleColor.Red); 587Output.Write(GetFormattedTestIndicator(CommandLineResources.PassedTestIndicator), OutputLevel.Information, ConsoleColor.Green); 611Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information, ConsoleColor.Yellow); 781ConsoleColor? color = null; 784color = ConsoleColor.Red; 788color = ConsoleColor.Green; 792color = ConsoleColor.Yellow; 858Output.Information(false, ConsoleColor.Green, CommandLineResources.TestRunSuccessful); 869Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests)); 873Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests)); 877Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests));
vstest.console.arm64 (18)
src\vstest\src\vstest.console\Internal\ConsoleLogger.cs (18)
304Output.Information(false, ConsoleColor.Red, TestResultPrefix + CommandLineResources.ErrorMessageBanner); 306Output.Information(false, ConsoleColor.Red, errorMessage); 312Output.Information(false, ConsoleColor.Red, TestResultPrefix + CommandLineResources.StacktraceBanner); 314Output.Information(false, ConsoleColor.Red, stackTrace); 338Output.Information(false, ConsoleColor.Red, TestResultPrefix + CommandLineResources.StdErrMessagesBanner); 339Output.Information(false, ConsoleColor.Red, stdErrMessages); 547Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information, ConsoleColor.Yellow); 570Output.Write(GetFormattedTestIndicator(CommandLineResources.FailedTestIndicator), OutputLevel.Information, ConsoleColor.Red); 587Output.Write(GetFormattedTestIndicator(CommandLineResources.PassedTestIndicator), OutputLevel.Information, ConsoleColor.Green); 611Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information, ConsoleColor.Yellow); 781ConsoleColor? color = null; 784color = ConsoleColor.Red; 788color = ConsoleColor.Green; 792color = ConsoleColor.Yellow; 858Output.Information(false, ConsoleColor.Green, CommandLineResources.TestRunSuccessful); 869Output.Information(false, ConsoleColor.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests)); 873Output.Information(false, ConsoleColor.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests)); 877Output.Information(false, ConsoleColor.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests));