-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Discussion: PowerShell needs to support 24bit color. Where? How? #2381
Copy link
Copy link
Closed
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Interactive-Consolethe console experiencethe console experience
Milestone
Metadata
Metadata
Assignees
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Interactive-Consolethe console experiencethe console experience
Since the Windows console now has 24bit color support, it seems obvious to me that PowerShell needs to build support for that in the same release timeframe.
As a reminder, 24-bit color means 256 values each for red, green, blue -- without an alpha channel.
For the sake of argument, let's assume that at a minimum, Write-Host needs to support Foreground and Background colors as 24bit values ...
What should the syntax be for 24bit color?
The most obvious suggestion is the HTML
#rrggbbsyntax -- but that would be a comment. We could pass it as a quoted string, but we could also choose to accept simple unadornedrrggbb...A richer choice would be to add a
[Color]type, which would allow for syntax like:[color]"336699"or even RGB values like[color](51, 102, 153)or even[color]@{h=210; s=50; l=40}(all of which represent the same color)...Any other thoughts?
Where should colors work?
The most obvious place where this is definitely needed is in the
Write-Hostcommand.However, I would also like support in the colors that are specified for
$Host.PrivateData... where I think it would be particularly helpful to be able to pick colors that are not one of the 16 colors, and of course, it would be wonderful if the core 16 colors could be available there as well, so that we could theme our console by just setting those values ;-)Additionally, we need to be able to support colors in format files, perhaps we need foreground/background settings on the table/row/column/cell elements, or perhaps we just need a function like
Get-AnsiCode, or a property on a type like the aforementioned[Color]so we could put the VT escape sequences into a string, like:Write-Host "$(([color](51, 102, 153)).Foreground)This is blue$([Color]::reset) and this isn't"...Finally, many modules (like PSReadLine and PowerLine) need to support colors, and I would really like them to all support the same syntax for setting colors (and/or the same
Colortype).Have I missed anything?
Is there a better syntax? Other commands or classes that need colors? Do you wish I would just go off and do this in a module instead of asking for it in the core shell? Please speak up here!