-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Developers using Console can employ VT/ANSI APIs (eg to use embedded color codes) #44513
Comments
Tagging subscribers to this area: @eiriktsarpalis, @jeffhandley Issue meta data
|
Another useful part of System.CommandLine.Rendering that we may want to pull into the BCL is the |
I think the biggest help to PowerShell is a .NET API that returns the plain text version of a string (removing all ANSI decoration). |
If we look not PowerShell itself but PowerShell module PSReadline - I believe we can find some other methods which could be great candidates for System.Console VT/ANSI APIs. |
In short:
/cc @DHowett |
Moving this issue to .NET 7. We will consider this as part of a potential effort for a System.Console redesign as described in #52374. |
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
cc: @eerhardt
The text was updated successfully, but these errors were encountered: