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 ?

Tim Jarvis
  • 18,465
  • 9
  • 55
  • 92

1 Answers1

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
dahlbyk
  • 75,175
  • 8
  • 100
  • 122
  • cygwin and color.diff auto color.status auto color.branch auto color.interactive true – Tim Jarvis Sep 18 '12 at 04:52
  • 1
    @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`. – dahlbyk Mar 12 '13 at 02:32
  • 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. – Klas Mellbourn Mar 12 '13 at 05:53
  • Honestly, I would just start hosting PowerShell in Console2 or ConEmu which use a more standard (and easily customizable) color palette. – dahlbyk Mar 18 '13 at 14:44