Posh-git: Gray and DarkGray are swapped

Created on 3 Apr 2019  路  2Comments  路  Source: dahlbyk/posh-git

System Details

  • posh-git version/path: 1.0.0 beta3 C:\Program Files\PowerShell\Modules\posh-git1.0.0
  • PowerShell version: 6.1.3
  • Git version: 2.21.0.windows.1
  • OS: Microsoft Windows NT 10.0.17763.0

Issue Description

Get-VirtualTerminalSequence returns the following for:

Gray:     
DarkGray: 

Expected output:

Gray:     
DarkGray: 

Preferably, ConsoleColor would be checked before HTMLColor.

Most helpful comment

It never occurred to me that HTML/CSS/SVG Gray would be darker than DarkGray, but here we are:

image

https://en.wikipedia.org/wiki/Web_colors

All 2 comments

We went back and forth on which to support first. We decided to support HtmlColor names first because supplying a ConsoleColor is easy - just set the color to ([ConsoleColor]::Gray). Also, when you use a ConsoleColor you're going to get the color as defined by the index of your console host properties color tab:

PS> &(gmo posh-git) { EscapeAnsiString (Get-VirtualTerminalSequence ([ConsoleColor]::Gray)) }
`e[37m

PS> &(gmo posh-git) { EscapeAnsiString (Get-VirtualTerminalSequence ([ConsoleColor]::DarkGray)) }
`e[90m

Regarding the HtmlColor definitions of Gray and DarkGray, we are just using what the System.Drawing.ColorTranslator.FromHtml() method is returning. If you think those values are wrong, you should submit an issue to the CoreFx repo.

It never occurred to me that HTML/CSS/SVG Gray would be darker than DarkGray, but here we are:

image

https://en.wikipedia.org/wiki/Web_colors

Was this page helpful?
0 / 5 - 0 ratings