-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
ANSI 256-color and 24-bit color support #455
Conversation
24-bit support depends on System.Drawing for parsing HTML color strings.
Interesting... so a question maybe for @lzybkr: is it expected that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
256 color/24 bit color support is in the Creators update - hopefully hitting RTM soon. You can try out insiders builds to see it working - there's nothing special about it in PowerShell, see https://twitter.com/lzybkr/status/779069905136037888
src/AnsiUtils.ps1
Outdated
@@ -20,10 +20,28 @@ $ConsoleColorToAnsi = @( | |||
$AnsiDefaultColor = 39 | |||
$AnsiEscape = [char]27 + "[" | |||
|
|||
[Reflection.Assembly]::LoadWithPartialName('System.Drawing') > $null | |||
$ColorTranslatorType = ([System.Management.Automation.PSTypeName]'System.Drawing.ColorTranslator').Type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
$ColorTranslatorType = 'System.Drawing.ColorTranslator' -as [Type]
Regarding If you set fore/background colors via escape sequences, then I believe If you set fore/background colors via a specific Win32 api, I think Ideally ANSI would have push/pop semantics, but that doesn't exist unfortunately. |
@lzybkr so from posh-git's standpoint, then, would you agree that it is most correct for us to continue using I guess what confuses me most is the distinction between |
Merged so I can more easily bring |
This PR adds support for colors beyond
[ConsoleColor]
:[byte]
color values are processed as as Xterm 256 colors[System.Drawing.Color]
color values are processed as 24-bit colors[string]
values are parsed as HTML color values and processed as 24-bit colorsIncludes #454 for adjusting
Write-Prompt
semantics, updated for 1.0 changes.24-bit support currently depends on System.Drawing. Not sure what Core options are there, but I've tried to make the assembly/type loading resilient.
Usage
I have tried testing with ConEmu, but 256-color mode doesn't seem to be working? Or is that a limitation of PS v5?