Search code examples
gitpowershellposh-git

Why no yellow in powershell and posh git


Ok, so in git bash this cmd..

git log --pretty='%C(yellow)%h%Creset %s' --abbrev-commit

gives me a yellow commit id and white subject line, but in powershell (with posh git) I get no yellow commit id (it's the default white).

Why ?


Solution

  • It turns out PowerShell's console renders System.ConsoleColor.DarkYellow as white:

    [Enum]::GetValues([ConsoleColor]) | %{ Write-Host $_ -ForegroundColor $_ }
    

    Using bold yellow instead, which renders with System.ConsoleColor.Yellow, works:

    git log --pretty='%C(bold yellow)%h%Creset %s' --abbrev-commit