Skip to content

Commit b6a4ae6

Browse files
committed
Fix PR comments
1 parent 4749eb0 commit b6a4ae6

File tree

3 files changed

+58
-38
lines changed

3 files changed

+58
-38
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The following built-in themes are available:
4646
* `AnsiConsoleTheme.Literate` - an ANSI 256-color version of the "literate" theme
4747
* `AnsiConsoleTheme.Grayscale` - an ANSI 256-color version of the "grayscale" theme
4848
* `AnsiConsoleTheme.Code` - an ANSI 256-color Visual Studio Code-inspired theme
49-
* `AnsiConsoleTheme.Sixteen` - an ANSI 16-color version of the "literate" theme that works with light and dark backgrounds
49+
* `AnsiConsoleTheme.Sixteen` - an ANSI 16-color theme that works well with both light and dark backgrounds
5050

5151
Adding a new theme is straightforward; examples can be found in the [`SystemConsoleThemes`](https://github.com/serilog/serilog-sinks-console/blob/dev/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/SystemConsoleThemes.cs) and [`AnsiConsoleThemes`](https://github.com/serilog/serilog-sinks-console/blob/dev/src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleThemes.cs) classes.
5252

src/Serilog.Sinks.Console/Sinks/SystemConsole/Themes/AnsiConsoleThemes.cs

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,6 @@ namespace Serilog.Sinks.SystemConsole.Themes
1818
{
1919
static class AnsiConsoleThemes
2020
{
21-
const string Reset = "\x1b[0m";
22-
const string Bold = "\x1b[1m";
23-
24-
const string Black = "\x1b[30m";
25-
const string Red = "\x1b[31m";
26-
const string Green = "\x1b[32m";
27-
const string Yellow = "\x1b[33m";
28-
const string Blue = "\x1b[34m";
29-
const string Magenta = "\x1b[35m";
30-
const string Cyan = "\x1b[36m";
31-
const string White = "\x1b[37m";
32-
33-
const string BrightBlack = "\x1b[30;1m";
34-
const string BrightRed = "\x1b[31;1m";
35-
const string BrightGreen = "\x1b[32;1m";
36-
const string BrightYellow = "\x1b[33;1m";
37-
const string BrightBlue = "\x1b[34;1m";
38-
const string BrightMagenta = "\x1b[35;1m";
39-
const string BrightCyan = "\x1b[36;1m";
40-
const string BrightWhite = "\x1b[37;1m";
41-
4221
public static AnsiConsoleTheme Literate { get; } = new AnsiConsoleTheme(
4322
new Dictionary<ConsoleThemeStyle, string>
4423
{
@@ -105,22 +84,22 @@ static class AnsiConsoleThemes
10584
public static AnsiConsoleTheme Sixteen { get; } = new AnsiConsoleTheme(
10685
new Dictionary<ConsoleThemeStyle, string>
10786
{
108-
[ConsoleThemeStyle.Text] = Reset,
109-
[ConsoleThemeStyle.SecondaryText] = Reset,
110-
[ConsoleThemeStyle.TertiaryText] = Reset,
111-
[ConsoleThemeStyle.Invalid] = Yellow,
112-
[ConsoleThemeStyle.Null] = Blue,
113-
[ConsoleThemeStyle.Name] = Reset,
114-
[ConsoleThemeStyle.String] = Cyan,
115-
[ConsoleThemeStyle.Number] = Magenta,
116-
[ConsoleThemeStyle.Boolean] = Blue,
117-
[ConsoleThemeStyle.Scalar] = Green,
118-
[ConsoleThemeStyle.LevelVerbose] = Reset,
119-
[ConsoleThemeStyle.LevelDebug] = Bold,
120-
[ConsoleThemeStyle.LevelInformation] = BrightCyan,
121-
[ConsoleThemeStyle.LevelWarning] = BrightYellow,
122-
[ConsoleThemeStyle.LevelError] = BrightRed,
123-
[ConsoleThemeStyle.LevelFatal] = "\x1b[38;5;0015m\x1b[48;5;0196m",
87+
[ConsoleThemeStyle.Text] = AnsiEscapeSequence.Unthemed,
88+
[ConsoleThemeStyle.SecondaryText] = AnsiEscapeSequence.Unthemed,
89+
[ConsoleThemeStyle.TertiaryText] = AnsiEscapeSequence.Unthemed,
90+
[ConsoleThemeStyle.Invalid] = AnsiEscapeSequence.Yellow,
91+
[ConsoleThemeStyle.Null] = AnsiEscapeSequence.Blue,
92+
[ConsoleThemeStyle.Name] = AnsiEscapeSequence.Unthemed,
93+
[ConsoleThemeStyle.String] = AnsiEscapeSequence.Cyan,
94+
[ConsoleThemeStyle.Number] = AnsiEscapeSequence.Magenta,
95+
[ConsoleThemeStyle.Boolean] = AnsiEscapeSequence.Blue,
96+
[ConsoleThemeStyle.Scalar] = AnsiEscapeSequence.Green,
97+
[ConsoleThemeStyle.LevelVerbose] = AnsiEscapeSequence.Unthemed,
98+
[ConsoleThemeStyle.LevelDebug] = AnsiEscapeSequence.Bold,
99+
[ConsoleThemeStyle.LevelInformation] = AnsiEscapeSequence.BrightCyan,
100+
[ConsoleThemeStyle.LevelWarning] = AnsiEscapeSequence.BrightYellow,
101+
[ConsoleThemeStyle.LevelError] = AnsiEscapeSequence.BrightRed,
102+
[ConsoleThemeStyle.LevelFatal] = AnsiEscapeSequence.BrightRed,
124103
});
125104
}
126105
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2017 Serilog Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
namespace Serilog.Sinks.SystemConsole.Themes
16+
{
17+
static class AnsiEscapeSequence
18+
{
19+
public const string Unthemed = "";
20+
public const string Reset = "\x1b[0m";
21+
public const string Bold = "\x1b[1m";
22+
23+
public const string Black = "\x1b[30m";
24+
public const string Red = "\x1b[31m";
25+
public const string Green = "\x1b[32m";
26+
public const string Yellow = "\x1b[33m";
27+
public const string Blue = "\x1b[34m";
28+
public const string Magenta = "\x1b[35m";
29+
public const string Cyan = "\x1b[36m";
30+
public const string White = "\x1b[37m";
31+
32+
public const string BrightBlack = "\x1b[30;1m";
33+
public const string BrightRed = "\x1b[31;1m";
34+
public const string BrightGreen = "\x1b[32;1m";
35+
public const string BrightYellow = "\x1b[33;1m";
36+
public const string BrightBlue = "\x1b[34;1m";
37+
public const string BrightMagenta = "\x1b[35;1m";
38+
public const string BrightCyan = "\x1b[36;1m";
39+
public const string BrightWhite = "\x1b[37;1m";
40+
}
41+
}

0 commit comments

Comments
 (0)