Why no yellow in powershell and posh git
Asked Answered
C

1

10

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 ?

Corneliacornelian answered 17/7, 2012 at 2:0 Comment(0)
E
10

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
Epistemic answered 18/9, 2012 at 1:57 Comment(4)
cygwin and color.diff auto color.status auto color.branch auto color.interactive trueCorneliacornelian
@Klas I'm not sure what you mean? posh-git colors can be configured by setting @GitPromptSettings properties, but by default all yellow colors are Yellow not DarkYellow.Epistemic
My bad. I was thinking of git output, like the hashes in "git reflog", but that is not posh-git's fault of course. I guess I have to look through the git-config(1) man page to find all the color settings that are set to yellow in windows.Calbert
Honestly, I would just start hosting PowerShell in Console2 or ConEmu which use a more standard (and easily customizable) color palette.Epistemic

© 2022 - 2024 — McMap. All rights reserved.