573 references to ConsoleColor
aspire (43)
Commands\LogsCommand.cs (2)
257
var logParser = new LogParser(
ConsoleColor
.Black);
298
var logParser = new LogParser(
ConsoleColor
.Black);
Mcp\Tools\ListConsoleLogsTool.cs (1)
64
var logParser = new LogParser(
ConsoleColor
.Black);
src\Shared\ConsoleLogs\AnsiParser.cs (38)
67
public static ConversionResult ConvertToHtml(string? text, ParserState? priorResidualState = null,
ConsoleColor
? defaultBackgroundColor = null)
200
private static void ProcessParameters(
ConsoleColor
? defaultBackgroundColor, ref ParserState newState, int[] parameters)
521
ConsoleColor
.Black => state.Bright ? "ansi-fg-brightblack" : "ansi-fg-black",
522
ConsoleColor
.Blue => state.Bright ? "ansi-fg-brightblue" : "ansi-fg-blue",
523
ConsoleColor
.Cyan => state.Bright ? "ansi-fg-brightcyan" : "ansi-fg-cyan",
524
ConsoleColor
.Green => state.Bright ? "ansi-fg-brightgreen" : "ansi-fg-green",
525
ConsoleColor
.Magenta => state.Bright ? "ansi-fg-brightmagenta" : "ansi-fg-magenta",
526
ConsoleColor
.Red => state.Bright ? "ansi-fg-brightred" : "ansi-fg-red",
527
ConsoleColor
.White => state.Bright ? "ansi-fg-brightwhite" : "ansi-fg-white",
528
ConsoleColor
.Yellow => state.Bright ? "ansi-fg-brightyellow" : "ansi-fg-yellow",
537
ConsoleColor
.Black => "ansi-bg-black",
538
ConsoleColor
.Blue => "ansi-bg-blue",
539
ConsoleColor
.Cyan => "ansi-bg-cyan",
540
ConsoleColor
.Green => "ansi-bg-green",
541
ConsoleColor
.Magenta => "ansi-bg-magenta",
542
ConsoleColor
.Red => "ansi-bg-red",
543
ConsoleColor
.White => "ansi-bg-white",
544
ConsoleColor
.Yellow => "ansi-bg-yellow",
549
private static bool TryGetForegroundColor(int number, out
ConsoleColor
? color)
553
30 =>
ConsoleColor
.Black,
554
31 =>
ConsoleColor
.Red,
555
32 =>
ConsoleColor
.Green,
556
33 =>
ConsoleColor
.Yellow,
557
34 =>
ConsoleColor
.Blue,
558
35 =>
ConsoleColor
.Magenta,
559
36 =>
ConsoleColor
.Cyan,
560
37 =>
ConsoleColor
.White,
566
private static bool TryGetBackgroundColor(int number, out
ConsoleColor
? color)
570
40 =>
ConsoleColor
.Black,
571
41 =>
ConsoleColor
.Red,
572
42 =>
ConsoleColor
.Green,
573
43 =>
ConsoleColor
.Yellow,
574
44 =>
ConsoleColor
.Blue,
575
45 =>
ConsoleColor
.Magenta,
576
46 =>
ConsoleColor
.Cyan,
577
47 =>
ConsoleColor
.White,
863
public
ConsoleColor
? ForegroundColor { get; set; }
864
public
ConsoleColor
? BackgroundColor { get; set; }
src\Shared\ConsoleLogs\LogParser.cs (2)
10
private readonly
ConsoleColor
_defaultBackgroundColor;
14
public LogParser(
ConsoleColor
defaultBackgroundColor, bool encodeForHtml = false)
Aspire.Dashboard (44)
Components\Pages\ConsoleLogs.razor.cs (1)
782
var logParser = new LogParser(
ConsoleColor
.Black, encodeForHtml: true);
Mcp\AspireResourceMcpTools.cs (1)
94
var logParser = new LogParser(
ConsoleColor
.Black, encodeForHtml: true);
Model\Assistant\AssistantChatDataContext.cs (1)
252
var logParser = new LogParser(
ConsoleColor
.Black);
Model\ConsoleLogsFetcher.cs (1)
32
var logParser = new LogParser(
ConsoleColor
.Black);
src\Shared\ConsoleLogs\AnsiParser.cs (38)
67
public static ConversionResult ConvertToHtml(string? text, ParserState? priorResidualState = null,
ConsoleColor
? defaultBackgroundColor = null)
200
private static void ProcessParameters(
ConsoleColor
? defaultBackgroundColor, ref ParserState newState, int[] parameters)
521
ConsoleColor
.Black => state.Bright ? "ansi-fg-brightblack" : "ansi-fg-black",
522
ConsoleColor
.Blue => state.Bright ? "ansi-fg-brightblue" : "ansi-fg-blue",
523
ConsoleColor
.Cyan => state.Bright ? "ansi-fg-brightcyan" : "ansi-fg-cyan",
524
ConsoleColor
.Green => state.Bright ? "ansi-fg-brightgreen" : "ansi-fg-green",
525
ConsoleColor
.Magenta => state.Bright ? "ansi-fg-brightmagenta" : "ansi-fg-magenta",
526
ConsoleColor
.Red => state.Bright ? "ansi-fg-brightred" : "ansi-fg-red",
527
ConsoleColor
.White => state.Bright ? "ansi-fg-brightwhite" : "ansi-fg-white",
528
ConsoleColor
.Yellow => state.Bright ? "ansi-fg-brightyellow" : "ansi-fg-yellow",
537
ConsoleColor
.Black => "ansi-bg-black",
538
ConsoleColor
.Blue => "ansi-bg-blue",
539
ConsoleColor
.Cyan => "ansi-bg-cyan",
540
ConsoleColor
.Green => "ansi-bg-green",
541
ConsoleColor
.Magenta => "ansi-bg-magenta",
542
ConsoleColor
.Red => "ansi-bg-red",
543
ConsoleColor
.White => "ansi-bg-white",
544
ConsoleColor
.Yellow => "ansi-bg-yellow",
549
private static bool TryGetForegroundColor(int number, out
ConsoleColor
? color)
553
30 =>
ConsoleColor
.Black,
554
31 =>
ConsoleColor
.Red,
555
32 =>
ConsoleColor
.Green,
556
33 =>
ConsoleColor
.Yellow,
557
34 =>
ConsoleColor
.Blue,
558
35 =>
ConsoleColor
.Magenta,
559
36 =>
ConsoleColor
.Cyan,
560
37 =>
ConsoleColor
.White,
566
private static bool TryGetBackgroundColor(int number, out
ConsoleColor
? color)
570
40 =>
ConsoleColor
.Black,
571
41 =>
ConsoleColor
.Red,
572
42 =>
ConsoleColor
.Green,
573
43 =>
ConsoleColor
.Yellow,
574
44 =>
ConsoleColor
.Blue,
575
45 =>
ConsoleColor
.Magenta,
576
46 =>
ConsoleColor
.Cyan,
577
47 =>
ConsoleColor
.White,
863
public
ConsoleColor
? ForegroundColor { get; set; }
864
public
ConsoleColor
? BackgroundColor { get; set; }
src\Shared\ConsoleLogs\LogParser.cs (2)
10
private readonly
ConsoleColor
_defaultBackgroundColor;
14
public LogParser(
ConsoleColor
defaultBackgroundColor, bool encodeForHtml = false)
Aspire.Dashboard.Tests (14)
ConsoleLogsTests\AnsiParserTests.cs (8)
65
var expectedResidualState = new AnsiParser.ParserState() { ForegroundColor =
ConsoleColor
.Green };
149
Assert.Equal(new AnsiParser.ParserState() { ForegroundColor =
ConsoleColor
.Green }, result1.ResidualState);
165
Assert.Equal(new AnsiParser.ParserState() { ForegroundColor =
ConsoleColor
.Green, BackgroundColor =
ConsoleColor
.Green }, result1.ResidualState);
217
var expectedResidualState = new AnsiParser.ParserState() { ForegroundColor =
ConsoleColor
.Green, BackgroundColor =
ConsoleColor
.Green };
229
var expectedResidualState = new AnsiParser.ParserState() { Bright = true, BackgroundColor =
ConsoleColor
.Green };
241
var expectedResidualState = new AnsiParser.ParserState() { Bright = true, ForegroundColor =
ConsoleColor
.Green };
ConsoleLogsTests\LogEntriesTests.cs (6)
20
var logParser = new LogParser(
ConsoleColor
.Black, encodeForHtml: true);
32
var logParser = new LogParser(
ConsoleColor
.Black, encodeForHtml: true);
299
var 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")]
311
public void CreateLogEntry_DefaultBackgroundColor_SkipMatchingColor(
ConsoleColor
defaultBackgroundColor, string output)
dotnet (45)
Commands\Test\MTP\Terminal\IConsole.cs (4)
19
void SetForegroundColor(
ConsoleColor
color);
21
void SetBackgroundColor(
ConsoleColor
color);
23
ConsoleColor
GetForegroundColor();
25
ConsoleColor
GetBackgroundColor();
Commands\Test\MTP\Terminal\NonAnsiTerminal.cs (19)
14
private readonly
ConsoleColor
_defaultForegroundColor;
19
=> _defaultForegroundColor = IsForegroundColorNotSupported() ?
ConsoleColor
.Black : console.GetForegroundColor();
52
private
ConsoleColor
ToConsoleColor(TerminalColor color) => color switch
54
TerminalColor.Black =>
ConsoleColor
.Black,
55
TerminalColor.DarkRed =>
ConsoleColor
.DarkRed,
56
TerminalColor.DarkGreen =>
ConsoleColor
.DarkGreen,
57
TerminalColor.DarkYellow =>
ConsoleColor
.DarkYellow,
58
TerminalColor.DarkBlue =>
ConsoleColor
.DarkBlue,
59
TerminalColor.DarkMagenta =>
ConsoleColor
.DarkMagenta,
60
TerminalColor.DarkCyan =>
ConsoleColor
.DarkCyan,
61
TerminalColor.Gray =>
ConsoleColor
.White,
63
TerminalColor.DarkGray =>
ConsoleColor
.Gray,
64
TerminalColor.Red =>
ConsoleColor
.Red,
65
TerminalColor.Green =>
ConsoleColor
.Green,
66
TerminalColor.Yellow =>
ConsoleColor
.Yellow,
67
TerminalColor.Blue =>
ConsoleColor
.Blue,
68
TerminalColor.Magenta =>
ConsoleColor
.Magenta,
69
TerminalColor.Cyan =>
ConsoleColor
.Cyan,
70
TerminalColor.White =>
ConsoleColor
.White,
Commands\Test\MTP\Terminal\SystemConsole.cs (4)
95
public void SetForegroundColor(
ConsoleColor
color)
98
public void SetBackgroundColor(
ConsoleColor
color)
101
public
ConsoleColor
GetForegroundColor()
104
public
ConsoleColor
GetBackgroundColor()
Commands\Test\MTP\Terminal\SystemConsoleColor.cs (1)
14
public
ConsoleColor
ConsoleColor { get; init; }
Commands\Test\MTP\Terminal\TerminalTestReporter.cs (17)
1023
private static TerminalColor ToTerminalColor(
ConsoleColor
consoleColor)
1026
ConsoleColor
.Black => TerminalColor.Black,
1027
ConsoleColor
.DarkBlue => TerminalColor.DarkBlue,
1028
ConsoleColor
.DarkGreen => TerminalColor.DarkGreen,
1029
ConsoleColor
.DarkCyan => TerminalColor.DarkCyan,
1030
ConsoleColor
.DarkRed => TerminalColor.DarkRed,
1031
ConsoleColor
.DarkMagenta => TerminalColor.DarkMagenta,
1032
ConsoleColor
.DarkYellow => TerminalColor.DarkYellow,
1033
ConsoleColor
.DarkGray => TerminalColor.DarkGray,
1034
ConsoleColor
.Gray => TerminalColor.Gray,
1035
ConsoleColor
.Blue => TerminalColor.Blue,
1036
ConsoleColor
.Green => TerminalColor.Green,
1037
ConsoleColor
.Cyan => TerminalColor.Cyan,
1038
ConsoleColor
.Red => TerminalColor.Red,
1039
ConsoleColor
.Magenta => TerminalColor.Magenta,
1040
ConsoleColor
.Yellow => TerminalColor.Yellow,
1041
ConsoleColor
.White => TerminalColor.White,
dotnet-dev-certs (18)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (12)
37
public
ConsoleColor
OriginalForegroundColor { get; }
39
private static void SetColor(
ConsoleColor
color)
41
Console.ForegroundColor = (
ConsoleColor
)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07));
52
Console.ForegroundColor = (
ConsoleColor
)((int)Console.ForegroundColor ^ 0x08);
110
SetColor(
ConsoleColor
.Black);
113
SetColor(
ConsoleColor
.Red);
116
SetColor(
ConsoleColor
.Green);
119
SetColor(
ConsoleColor
.Yellow);
122
SetColor(
ConsoleColor
.Blue);
125
SetColor(
ConsoleColor
.Magenta);
128
SetColor(
ConsoleColor
.Cyan);
131
SetColor(
ConsoleColor
.Gray);
src\aspnetcore\src\Tools\Shared\CommandLine\ConsoleReporter.cs (4)
34
protected virtual void WriteLine(TextWriter writer, string message,
ConsoleColor
? color)
53
=> WriteLine(Console.Error, message,
ConsoleColor
.Red);
55
=> WriteLine(Console.Out, message,
ConsoleColor
.Yellow);
73
WriteLine(Console.Out, message,
ConsoleColor
.DarkGray);
src\aspnetcore\src\Tools\Shared\CommandLine\IConsole.cs (1)
22
ConsoleColor
ForegroundColor { get; set; }
src\aspnetcore\src\Tools\Shared\CommandLine\PhysicalConsole.cs (1)
32
public
ConsoleColor
ForegroundColor
dotnet-format (9)
Logging\SimpleConsoleLogger.cs (9)
20
private 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)
138
var
originalColor = Console.ForegroundColor;
141
Console.ForegroundColor =
ConsoleColor
.Yellow;
147
Console.ForegroundColor =
ConsoleColor
.Red;
dotnet-user-jwts (18)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (12)
37
public
ConsoleColor
OriginalForegroundColor { get; }
39
private static void SetColor(
ConsoleColor
color)
41
Console.ForegroundColor = (
ConsoleColor
)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07));
52
Console.ForegroundColor = (
ConsoleColor
)((int)Console.ForegroundColor ^ 0x08);
110
SetColor(
ConsoleColor
.Black);
113
SetColor(
ConsoleColor
.Red);
116
SetColor(
ConsoleColor
.Green);
119
SetColor(
ConsoleColor
.Yellow);
122
SetColor(
ConsoleColor
.Blue);
125
SetColor(
ConsoleColor
.Magenta);
128
SetColor(
ConsoleColor
.Cyan);
131
SetColor(
ConsoleColor
.Gray);
src\aspnetcore\src\Tools\Shared\CommandLine\ConsoleReporter.cs (4)
34
protected virtual void WriteLine(TextWriter writer, string message,
ConsoleColor
? color)
53
=> WriteLine(Console.Error, message,
ConsoleColor
.Red);
55
=> WriteLine(Console.Out, message,
ConsoleColor
.Yellow);
73
WriteLine(Console.Out, message,
ConsoleColor
.DarkGray);
src\aspnetcore\src\Tools\Shared\CommandLine\IConsole.cs (1)
22
ConsoleColor
ForegroundColor { get; set; }
src\aspnetcore\src\Tools\Shared\CommandLine\PhysicalConsole.cs (1)
32
public
ConsoleColor
ForegroundColor
dotnet-user-secrets (18)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (12)
37
public
ConsoleColor
OriginalForegroundColor { get; }
39
private static void SetColor(
ConsoleColor
color)
41
Console.ForegroundColor = (
ConsoleColor
)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07));
52
Console.ForegroundColor = (
ConsoleColor
)((int)Console.ForegroundColor ^ 0x08);
110
SetColor(
ConsoleColor
.Black);
113
SetColor(
ConsoleColor
.Red);
116
SetColor(
ConsoleColor
.Green);
119
SetColor(
ConsoleColor
.Yellow);
122
SetColor(
ConsoleColor
.Blue);
125
SetColor(
ConsoleColor
.Magenta);
128
SetColor(
ConsoleColor
.Cyan);
131
SetColor(
ConsoleColor
.Gray);
src\aspnetcore\src\Tools\Shared\CommandLine\ConsoleReporter.cs (4)
34
protected virtual void WriteLine(TextWriter writer, string message,
ConsoleColor
? color)
53
=> WriteLine(Console.Error, message,
ConsoleColor
.Red);
55
=> WriteLine(Console.Out, message,
ConsoleColor
.Yellow);
73
WriteLine(Console.Out, message,
ConsoleColor
.DarkGray);
src\aspnetcore\src\Tools\Shared\CommandLine\IConsole.cs (1)
22
ConsoleColor
ForegroundColor { get; set; }
src\aspnetcore\src\Tools\Shared\CommandLine\PhysicalConsole.cs (1)
32
public
ConsoleColor
ForegroundColor
ilasm (1)
IlasmRootCommand.cs (1)
177
Console.ForegroundColor =
ConsoleColor
.Red;
Microsoft.Arcade.Common (41)
CompactConsoleLoggerFormatter.cs (41)
115
private (
ConsoleColor
? Foreground,
ConsoleColor
? Background) GetLogLevelConsoleColors(LogLevel logLevel)
126
LogLevel.Trace => (
ConsoleColor
.Gray,
ConsoleColor
.Black),
127
LogLevel.Debug => (
ConsoleColor
.Gray,
ConsoleColor
.Black),
128
LogLevel.Information => (
ConsoleColor
.DarkGreen,
ConsoleColor
.Black),
129
LogLevel.Warning => (
ConsoleColor
.Yellow,
ConsoleColor
.Black),
130
LogLevel.Error => (
ConsoleColor
.Black,
ConsoleColor
.DarkRed),
131
LogLevel.Critical => (
ConsoleColor
.White,
ConsoleColor
.DarkRed),
136
private static void WriteColoredMessage(TextWriter textWriter, string message,
ConsoleColor
? background,
ConsoleColor
? foreground)
162
private static string GetForegroundColorEscapeCode(
ConsoleColor
color) => color switch
164
ConsoleColor
.Black => "\x1B[30m",
165
ConsoleColor
.DarkRed => "\x1B[31m",
166
ConsoleColor
.DarkGreen => "\x1B[32m",
167
ConsoleColor
.DarkYellow => "\x1B[33m",
168
ConsoleColor
.DarkBlue => "\x1B[34m",
169
ConsoleColor
.DarkMagenta => "\x1B[35m",
170
ConsoleColor
.DarkCyan => "\x1B[36m",
171
ConsoleColor
.Gray => "\x1B[37m",
172
ConsoleColor
.Red => "\x1B[1m\x1B[31m",
173
ConsoleColor
.Green => "\x1B[1m\x1B[32m",
174
ConsoleColor
.Yellow => "\x1B[1m\x1B[33m",
175
ConsoleColor
.Blue => "\x1B[1m\x1B[34m",
176
ConsoleColor
.Magenta => "\x1B[1m\x1B[35m",
177
ConsoleColor
.Cyan => "\x1B[1m\x1B[36m",
178
ConsoleColor
.White => "\x1B[1m\x1B[37m",
182
private static string GetBackgroundColorEscapeCode(
ConsoleColor
color) => color switch
184
ConsoleColor
.Black => "\x1B[40m",
185
ConsoleColor
.DarkRed => "\x1B[41m",
186
ConsoleColor
.DarkGreen => "\x1B[42m",
187
ConsoleColor
.DarkYellow => "\x1B[43m",
188
ConsoleColor
.DarkBlue => "\x1B[44m",
189
ConsoleColor
.DarkMagenta => "\x1B[45m",
190
ConsoleColor
.DarkCyan => "\x1B[46m",
191
ConsoleColor
.Gray => "\x1B[47m",
Microsoft.Build (83)
BackEnd\Client\MSBuildClient.cs (4)
369
ConsoleColor
backgroundColor = QueryConsoleBackgroundColor();
396
private
ConsoleColor
QueryConsoleBackgroundColor()
398
ConsoleColor
consoleBackgroundColor;
405
consoleBackgroundColor =
ConsoleColor
.Black;
Logging\BaseConsoleLogger.cs (44)
185
setColor(
ConsoleColor
.Green);
189
setColor(
ConsoleColor
.Gray);
196
setColor(
ConsoleColor
.Green);
200
setColor(
ConsoleColor
.Gray);
207
setColor(
ConsoleColor
.Green);
211
setColor(
ConsoleColor
.Gray);
218
setColor(
ConsoleColor
.Green);
222
setColor(
ConsoleColor
.Gray);
303
internal static void SetColor(
ConsoleColor
c)
334
internal static void SetColorAnsi(
ConsoleColor
c)
339
case
ConsoleColor
.Black: colorString += "30"; break;
340
case
ConsoleColor
.DarkBlue: colorString += "34"; break;
341
case
ConsoleColor
.DarkGreen: colorString += "32"; break;
342
case
ConsoleColor
.DarkCyan: colorString += "36"; break;
343
case
ConsoleColor
.DarkRed: colorString += "31"; break;
344
case
ConsoleColor
.DarkMagenta: colorString += "35"; break;
345
case
ConsoleColor
.DarkYellow: colorString += "33"; break;
346
case
ConsoleColor
.Gray: colorString += "37"; break;
347
case
ConsoleColor
.DarkGray: colorString += "30;1"; break;
348
case
ConsoleColor
.Blue: colorString += "34;1"; break;
349
case
ConsoleColor
.Green: colorString += "32;1"; break;
350
case
ConsoleColor
.Cyan: colorString += "36;1"; break;
351
case
ConsoleColor
.Red: colorString += "31;1"; break;
352
case
ConsoleColor
.Magenta: colorString += "35;1"; break;
353
case
ConsoleColor
.Yellow: colorString += "33;1"; break;
354
case
ConsoleColor
.White: colorString += "37;1"; break;
379
internal static
ConsoleColor
TransformColor(
ConsoleColor
foreground,
ConsoleColor
background)
381
ConsoleColor
result = foreground; // typically do nothing ...
385
result = background !=
ConsoleColor
.Black ?
ConsoleColor
.Black :
ConsoleColor
.Gray;
395
internal static void DontSetColor(
ConsoleColor
c)
420
ConsoleColor
c = ConsoleConfiguration.BackgroundColor;
511
setColor(
ConsoleColor
.Green);
519
setColor(
ConsoleColor
.Gray);
521
setColor(
ConsoleColor
.DarkGray);
532
setColor(
ConsoleColor
.Green);
537
setColor(
ConsoleColor
.Gray);
539
setColor(
ConsoleColor
.DarkGray);
559
setColor(
ConsoleColor
.Green);
651
setColor(
ConsoleColor
.Gray);
653
setColor(
ConsoleColor
.DarkGray);
Logging\ConsoleConfiguration.cs (1)
55
public static
ConsoleColor
BackgroundColor => Provider.BackgroundColor;
Logging\ConsoleLogger.cs (1)
30
public delegate void ColorSetter(
ConsoleColor
color);
Logging\IConsoleConfiguration.cs (1)
39
ConsoleColor
BackgroundColor { get; }
Logging\InProcessConsoleConfiguration.cs (2)
60
public
ConsoleColor
BackgroundColor
76
return
ConsoleColor
.Black;
Logging\ParallelLogger\ParallelConsoleLogger.cs (27)
283
setColor(
ConsoleColor
.Green);
313
setColor(
ConsoleColor
.Yellow);
320
setColor(
ConsoleColor
.Red);
385
setColor(
ConsoleColor
.Yellow);
394
setColor(
ConsoleColor
.Red);
426
setColor(
ConsoleColor
.Yellow);
432
setColor(
ConsoleColor
.Red);
695
setColor(
ConsoleColor
.Cyan);
775
setColor(
ConsoleColor
.Green);
780
setColor(
ConsoleColor
.Gray);
793
setColor(
ConsoleColor
.Green);
801
setColor(
ConsoleColor
.Gray);
841
setColor(
ConsoleColor
.DarkGray);
843
setColor(
ConsoleColor
.Gray);
929
setColor(
ConsoleColor
.Cyan);
967
setColor(
ConsoleColor
.DarkCyan);
1011
setColor(
ConsoleColor
.DarkCyan);
1074
setColor(
ConsoleColor
.Red);
1120
setColor(
ConsoleColor
.Yellow);
1298
setColor(
ConsoleColor
.DarkGray);
1361
setColor(
ConsoleColor
.Cyan);
1373
setColor(
ConsoleColor
.DarkGray);
1450
setColor(
ConsoleColor
.Cyan);
1538
setColor(
ConsoleColor
.Cyan);
1555
setColor(
ConsoleColor
.Cyan);
1615
setColor(
ConsoleColor
.Cyan);
1780
setColor(
ConsoleColor
.White);
Logging\TargetConsoleConfiguration.cs (3)
17
private
ConsoleColor
_backgroundColor;
19
public TargetConsoleConfiguration(int bufferWidth, bool acceptAnsiColorCodes, bool outputIsScreen,
ConsoleColor
backgroundColor)
40
public
ConsoleColor
BackgroundColor => _backgroundColor;
Microsoft.CodeAnalysis.Scripting (5)
Hosting\CommandLine\CommandLineRunner.cs (4)
346
Console.SetForegroundColor(
ConsoleColor
.Red);
391
Console.SetForegroundColor(diagnostic.Severity == DiagnosticSeverity.Error ?
ConsoleColor
.Red :
ConsoleColor
.Yellow);
398
Console.SetForegroundColor(
ConsoleColor
.DarkRed);
Hosting\CommandLine\ConsoleIO.cs (1)
31
public virtual void SetForegroundColor(
ConsoleColor
consoleColor) => Console.ForegroundColor = consoleColor;
Microsoft.DotNet.Cli.Utils (12)
AnsiConsole.cs (12)
35
public
ConsoleColor
OriginalForegroundColor { get; }
37
private void SetColor(
ConsoleColor
color)
48
_boldRecursion > 0 ? (
ConsoleColor
)(c | Light) : // ensure color is light
49
(
ConsoleColor
)(c & ~Light); // ensure color is dark
119
SetColor(
ConsoleColor
.Black);
122
SetColor(
ConsoleColor
.Red);
125
SetColor(
ConsoleColor
.Green);
128
SetColor(
ConsoleColor
.Yellow);
131
SetColor(
ConsoleColor
.Blue);
134
SetColor(
ConsoleColor
.Magenta);
137
SetColor(
ConsoleColor
.Cyan);
140
SetColor(
ConsoleColor
.Gray);
Microsoft.DotNet.HotReload.Watch (12)
UI\ConsoleInputReader.cs (4)
31
console.ForegroundColor =
ConsoleColor
.DarkGray;
59
WriteLine(keyDisplay,
ConsoleColor
.DarkRed);
87
void WriteLine(string message,
ConsoleColor
color =
ConsoleColor
.DarkGray)
UI\ConsoleReporter.cs (6)
23
private void WriteLine(TextWriter writer, string message,
ConsoleColor
? color, Emoji emoji)
27
console.ForegroundColor =
ConsoleColor
.DarkGray;
49
LogLevel.Critical or LogLevel.Error =>
ConsoleColor
.Red,
50
LogLevel.Warning =>
ConsoleColor
.Yellow,
51
LogLevel.Information => (
ConsoleColor
?)null,
52
_ =>
ConsoleColor
.DarkGray,
UI\IConsole.cs (1)
11
ConsoleColor
ForegroundColor { get; set; }
UI\PhysicalConsole.cs (1)
129
public
ConsoleColor
ForegroundColor
Microsoft.DotNet.VersionTools.Cli (2)
ConsoleLogger.cs (2)
17
var
fgColor = Console.ForegroundColor;
18
Console.ForegroundColor =
ConsoleColor
.Red;
Microsoft.Extensions.DotNetDeltaApplier (1)
src\sdk\src\Dotnet.Watch\HotReloadAgent.Host\StartupHook.cs (1)
169
Console.ForegroundColor =
ConsoleColor
.DarkGray;
Microsoft.Extensions.Logging.Console (81)
AnsiParser.cs (57)
12
private readonly Action<string, int, int,
ConsoleColor
?,
ConsoleColor
?> _onParseWrite;
13
public AnsiParser(Action<string, int, int,
ConsoleColor
?,
ConsoleColor
?> onParseWrite)
50
ConsoleColor
? foreground = null;
51
ConsoleColor
? background = null;
54
ConsoleColor
? color = null;
133
internal static string GetForegroundColorEscapeCode(
ConsoleColor
color)
137
ConsoleColor
.Black => "\e[30m",
138
ConsoleColor
.DarkRed => "\e[31m",
139
ConsoleColor
.DarkGreen => "\e[32m",
140
ConsoleColor
.DarkYellow => "\e[33m",
141
ConsoleColor
.DarkBlue => "\e[34m",
142
ConsoleColor
.DarkMagenta => "\e[35m",
143
ConsoleColor
.DarkCyan => "\e[36m",
144
ConsoleColor
.Gray => "\e[37m",
145
ConsoleColor
.Red => "\e[1m\e[31m",
146
ConsoleColor
.Green => "\e[1m\e[32m",
147
ConsoleColor
.Yellow => "\e[1m\e[33m",
148
ConsoleColor
.Blue => "\e[1m\e[34m",
149
ConsoleColor
.Magenta => "\e[1m\e[35m",
150
ConsoleColor
.Cyan => "\e[1m\e[36m",
151
ConsoleColor
.White => "\e[1m\e[37m",
156
internal static string GetBackgroundColorEscapeCode(
ConsoleColor
color)
160
ConsoleColor
.Black => "\e[40m",
161
ConsoleColor
.DarkRed => "\e[41m",
162
ConsoleColor
.DarkGreen => "\e[42m",
163
ConsoleColor
.DarkYellow => "\e[43m",
164
ConsoleColor
.DarkBlue => "\e[44m",
165
ConsoleColor
.DarkMagenta => "\e[45m",
166
ConsoleColor
.DarkCyan => "\e[46m",
167
ConsoleColor
.Gray => "\e[47m",
172
private static bool TryGetForegroundColor(int number, bool isBright, out
ConsoleColor
? color)
176
30 =>
ConsoleColor
.Black,
177
31 => isBright ?
ConsoleColor
.Red :
ConsoleColor
.DarkRed,
178
32 => isBright ?
ConsoleColor
.Green :
ConsoleColor
.DarkGreen,
179
33 => isBright ?
ConsoleColor
.Yellow :
ConsoleColor
.DarkYellow,
180
34 => isBright ?
ConsoleColor
.Blue :
ConsoleColor
.DarkBlue,
181
35 => isBright ?
ConsoleColor
.Magenta :
ConsoleColor
.DarkMagenta,
182
36 => isBright ?
ConsoleColor
.Cyan :
ConsoleColor
.DarkCyan,
183
37 => isBright ?
ConsoleColor
.White :
ConsoleColor
.Gray,
189
private static bool TryGetBackgroundColor(int number, out
ConsoleColor
? color)
193
40 =>
ConsoleColor
.Black,
194
41 =>
ConsoleColor
.DarkRed,
195
42 =>
ConsoleColor
.DarkGreen,
196
43 =>
ConsoleColor
.DarkYellow,
197
44 =>
ConsoleColor
.DarkBlue,
198
45 =>
ConsoleColor
.DarkMagenta,
199
46 =>
ConsoleColor
.DarkCyan,
200
47 =>
ConsoleColor
.Gray,
AnsiParsingLogConsole.cs (6)
30
private static bool SetColor(
ConsoleColor
? background,
ConsoleColor
? foreground)
36
private static bool SetBackgroundColor(
ConsoleColor
? background)
46
private static bool SetForegroundColor(
ConsoleColor
? foreground)
61
private void WriteToConsole(string message, int startIndex, int length,
ConsoleColor
? background,
ConsoleColor
? foreground)
SimpleConsoleFormatter.cs (16)
191
LogLevel.Trace => new ConsoleColors(
ConsoleColor
.Gray,
ConsoleColor
.Black),
192
LogLevel.Debug => new ConsoleColors(
ConsoleColor
.Gray,
ConsoleColor
.Black),
193
LogLevel.Information => new ConsoleColors(
ConsoleColor
.DarkGreen,
ConsoleColor
.Black),
194
LogLevel.Warning => new ConsoleColors(
ConsoleColor
.Yellow,
ConsoleColor
.Black),
195
LogLevel.Error => new ConsoleColors(
ConsoleColor
.Black,
ConsoleColor
.DarkRed),
196
LogLevel.Critical => new ConsoleColors(
ConsoleColor
.White,
ConsoleColor
.DarkRed),
230
public ConsoleColors(
ConsoleColor
? foreground,
ConsoleColor
? background)
236
public
ConsoleColor
? Foreground { get; }
238
public
ConsoleColor
? Background { get; }
TextWriterExtensions.cs (2)
11
public static void WriteColoredMessage(this TextWriter textWriter, string message,
ConsoleColor
? background,
ConsoleColor
? foreground)
Microsoft.ML.Core (5)
Environment\ConsoleEnvironment.cs (5)
58
var
messageColor = default(
ConsoleColor
);
65
messageColor =
ConsoleColor
.Gray;
70
messageColor =
ConsoleColor
.Yellow;
75
messageColor =
ConsoleColor
.Red;
Microsoft.TestPlatform.CoreUtilities (6)
Output\OutputExtensions.cs (6)
28
SetColorForAction(
ConsoleColor
.Red, () => Output(output, OutputLevel.Error, appendPrefix ? Resources.CommandLineError : DefaultFormat, format, args));
40
SetColorForAction(
ConsoleColor
.Yellow, () => Output(output, OutputLevel.Warning, appendPrefix ? Resources.CommandLineWarning : DefaultFormat, format, args));
63
public static void Information(this IOutput output, bool appendPrefix,
ConsoleColor
foregroundColor, string format, params object?[]? args)
75
public static void Write(this IOutput output, string message, OutputLevel level,
ConsoleColor
foregroundColor)
112
private static void SetColorForAction(
ConsoleColor
foregroundColor, Action action)
128
var
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 (34)
Commands\DeleteCommand.cs (3)
107
ConsoleColor
currentColor =
ConsoleColor
.Gray;
111
Console.ForegroundColor =
ConsoleColor
.Yellow;
Commands\Package\Update\PackageUpdateCommandRunner.cs (14)
65
ConsoleColor
.Red);
95
logger.LogMinimal(Strings.PackageUpdate_PreviewRestoreFailed,
ConsoleColor
.Red);
122
logger.LogMinimal(Format.PackageUpdate_FinalSummary(uniquePackageCount, totalPackagesScanned),
ConsoleColor
.Green);
201
logger.LogMinimal(Format.PackageUpdate_AllVersionsHaveAdvisories(packageIdentity.Id),
ConsoleColor
.Yellow);
337
logger.LogMinimal(Strings.PackageUpdate_NoVulnerablePackages,
ConsoleColor
.Green);
342
logger.LogMinimal(Strings.PackageUpdate_AlreadyUpToDate,
ConsoleColor
.Green);
436
logger.LogMinimal(Messages.Warning_AlreadyUsingSameVersion(package.Id, upgradeVersion.OriginalString!),
ConsoleColor
.Yellow);
446
logger.LogMinimal(Messages.Error_NoVersionsAvailable(package.Id),
ConsoleColor
.Red);
454
logger.LogMinimal(Messages.Warning_AlreadyHighestVersion(package.Id, latestVersion.OriginalVersion!, project.FilePath),
ConsoleColor
.Yellow);
506
ConsoleColor
.Red);
519
ConsoleColor
.Red);
539
ConsoleColor
.Red);
584
logger.LogMinimal(Messages.Error_NoVersionsAvailable(package.identity.Id),
ConsoleColor
.Red);
634
ConsoleColor
.Red);
Commands\PackageSearch\Table.cs (4)
33
private
ConsoleColor
_highlighter =
ConsoleColor
.Red;
37
private readonly
ConsoleColor
_consoleColor = Console.ForegroundColor;
114
ConsoleColor
color = _consoleColor;
ListPackage\ListPackageConsoleRenderer.cs (2)
148
Console.ForegroundColor =
ConsoleColor
.Blue;
171
Console.ForegroundColor =
ConsoleColor
.Blue;
Utility\CommandOutputLogger.cs (4)
144
public virtual void LogMinimal(string data,
ConsoleColor
color)
146
var
currentColor = Console.ForegroundColor;
152
public void LogInline(string data,
ConsoleColor
color)
154
var
currentColor = Console.ForegroundColor;
Utility\FormattedCell.cs (2)
14
public
ConsoleColor
? ForegroundColor { get; set; }
18
public FormattedCell(string value,
ConsoleColor
? foregroundColor = null)
Utility\ILoggerWithColor.cs (2)
18
void LogMinimal(string data,
ConsoleColor
color);
26
void LogInline(string data,
ConsoleColor
color);
Utility\ProjectPackagesPrintUtility.cs (3)
194
case 1: return new FormattedCell("Moderate", foregroundColor:
ConsoleColor
.Yellow);
195
case 2: return new FormattedCell("High", foregroundColor:
ConsoleColor
.Red);
196
case 3: return new FormattedCell("Critical", foregroundColor:
ConsoleColor
.Red);
rzc (12)
CommandLine\AnsiConsole.cs (12)
34
public
ConsoleColor
OriginalForegroundColor { get; }
36
private void SetColor(
ConsoleColor
color)
38
Console.ForegroundColor = (
ConsoleColor
)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07));
49
Console.ForegroundColor = (
ConsoleColor
)((int)Console.ForegroundColor ^ 0x08);
103
SetColor(
ConsoleColor
.Black);
106
SetColor(
ConsoleColor
.Red);
109
SetColor(
ConsoleColor
.Green);
112
SetColor(
ConsoleColor
.Yellow);
115
SetColor(
ConsoleColor
.Blue);
118
SetColor(
ConsoleColor
.Magenta);
121
SetColor(
ConsoleColor
.Cyan);
124
SetColor(
ConsoleColor
.Gray);
SuperFileCheck (9)
Program.cs (9)
497
Console.ForegroundColor =
ConsoleColor
.Red;
507
Console.ForegroundColor =
ConsoleColor
.Red;
517
Console.ForegroundColor =
ConsoleColor
.Red;
528
Console.ForegroundColor =
ConsoleColor
.Red;
542
Console.ForegroundColor =
ConsoleColor
.Red;
665
Console.ForegroundColor =
ConsoleColor
.Red;
741
Console.ForegroundColor =
ConsoleColor
.Red;
756
Console.ForegroundColor =
ConsoleColor
.Red;
772
Console.ForegroundColor =
ConsoleColor
.Red;
System.CommandLine (1)
ConsoleHelpers.cs (1)
27
Console.ForegroundColor =
ConsoleColor
.Red;
System.Console (16)
System\Console.cs (7)
323
internal const
ConsoleColor
UnknownColor = (
ConsoleColor
)(-1);
329
public static
ConsoleColor
BackgroundColor
339
public static
ConsoleColor
ForegroundColor
529
ConsolePal.MoveBufferArea(sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop, ' ',
ConsoleColor
.Black, BackgroundColor);
533
public 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)
164
private static
ConsoleColor
s_trackedForegroundColor = Console.UnknownColor;
165
private static
ConsoleColor
s_trackedBackgroundColor = Console.UnknownColor;
167
public static
ConsoleColor
ForegroundColor
173
public static
ConsoleColor
BackgroundColor
722
public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar,
ConsoleColor
sourceForeColor,
ConsoleColor
sourceBackColor)
757
private static void RefreshColors(ref
ConsoleColor
toChange,
ConsoleColor
value)
785
private static void WriteSetColorString(bool foreground,
ConsoleColor
color)
vstest.console (18)
Internal\ConsoleLogger.cs (18)
304
Output.Information(false,
ConsoleColor
.Red, TestResultPrefix + CommandLineResources.ErrorMessageBanner);
306
Output.Information(false,
ConsoleColor
.Red, errorMessage);
312
Output.Information(false,
ConsoleColor
.Red, TestResultPrefix + CommandLineResources.StacktraceBanner);
314
Output.Information(false,
ConsoleColor
.Red, stackTrace);
338
Output.Information(false,
ConsoleColor
.Red, TestResultPrefix + CommandLineResources.StdErrMessagesBanner);
339
Output.Information(false,
ConsoleColor
.Red, stdErrMessages);
547
Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information,
ConsoleColor
.Yellow);
570
Output.Write(GetFormattedTestIndicator(CommandLineResources.FailedTestIndicator), OutputLevel.Information,
ConsoleColor
.Red);
587
Output.Write(GetFormattedTestIndicator(CommandLineResources.PassedTestIndicator), OutputLevel.Information,
ConsoleColor
.Green);
611
Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information,
ConsoleColor
.Yellow);
781
ConsoleColor
? color = null;
784
color =
ConsoleColor
.Red;
788
color =
ConsoleColor
.Green;
792
color =
ConsoleColor
.Yellow;
858
Output.Information(false,
ConsoleColor
.Green, CommandLineResources.TestRunSuccessful);
869
Output.Information(false,
ConsoleColor
.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests));
873
Output.Information(false,
ConsoleColor
.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests));
877
Output.Information(false,
ConsoleColor
.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests));
vstest.console.arm64 (18)
src\vstest\src\vstest.console\Internal\ConsoleLogger.cs (18)
304
Output.Information(false,
ConsoleColor
.Red, TestResultPrefix + CommandLineResources.ErrorMessageBanner);
306
Output.Information(false,
ConsoleColor
.Red, errorMessage);
312
Output.Information(false,
ConsoleColor
.Red, TestResultPrefix + CommandLineResources.StacktraceBanner);
314
Output.Information(false,
ConsoleColor
.Red, stackTrace);
338
Output.Information(false,
ConsoleColor
.Red, TestResultPrefix + CommandLineResources.StdErrMessagesBanner);
339
Output.Information(false,
ConsoleColor
.Red, stdErrMessages);
547
Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information,
ConsoleColor
.Yellow);
570
Output.Write(GetFormattedTestIndicator(CommandLineResources.FailedTestIndicator), OutputLevel.Information,
ConsoleColor
.Red);
587
Output.Write(GetFormattedTestIndicator(CommandLineResources.PassedTestIndicator), OutputLevel.Information,
ConsoleColor
.Green);
611
Output.Write(GetFormattedTestIndicator(CommandLineResources.SkippedTestIndicator), OutputLevel.Information,
ConsoleColor
.Yellow);
781
ConsoleColor
? color = null;
784
color =
ConsoleColor
.Red;
788
color =
ConsoleColor
.Green;
792
color =
ConsoleColor
.Yellow;
858
Output.Information(false,
ConsoleColor
.Green, CommandLineResources.TestRunSuccessful);
869
Output.Information(false,
ConsoleColor
.Green, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryPassedTests, passedTests));
873
Output.Information(false,
ConsoleColor
.Red, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryFailedTests, failedTests));
877
Output.Information(false,
ConsoleColor
.Yellow, string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummarySkippedTests, skippedTests));