Open
Description
Usage in Microsoft.Extensions.Logging.Console
Console Formatters introduced in .NET 5.0 allow for the built-in SimpleConsoleFormatter to embed color codes to each log message. But this implementation required knowledge about hardcoding a mapping between VT100 color codes and different background/foreground color changes.
Instead of typing colors to the formatter, we should decouple this by exposing a generic VT100 builder for colors (maybe even a parser) into System.Console. This way, we can simplify the architecture in Microsoft.Extensions.Logging.Console by making ConsoleFormatters's job purely about building up string of log messages structured in a specific format when having colors involved.
Usage in System.CommandLine.Rendering
- System.CommandLine.Rendering/Ansi.cs shows similar logic being duplicated in dotnet/command-line-api as well.
cc: @eerhardt