Skip to content

Instantly share code, notes, and snippets.

@bradwilson
Last active December 7, 2017 12:30
Show Gist options
  • Save bradwilson/5ec6ce97ff9f17ecec08 to your computer and use it in GitHub Desktop.
Save bradwilson/5ec6ce97ff9f17ecec08 to your computer and use it in GitHub Desktop.
Custom Posh-Git prompt
# Background colors
$GitPromptSettings.AfterBackgroundColor = "DarkBlue"
$GitPromptSettings.AfterStashBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BeforeBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BeforeIndexBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BeforeStashBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchAheadStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchBehindAndAheadStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchBehindStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchIdenticalStatusToBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.DelimBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.IndexBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.LocalDefaultStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.LocalStagedStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.LocalWorkingStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.StashBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.WorkingBackgroundColor = $GitPromptSettings.AfterBackgroundColor
# Foreground colors
$GitPromptSettings.BranchForegroundColor = "Blue"
$GitPromptSettings.BranchIdenticalStatusToForegroundColor = "White"
$GitPromptSettings.DelimForegroundColor = "Blue"
$GitPromptSettings.IndexForegroundColor = "Green"
$GitPromptSettings.WorkingForegroundColor = "Yellow"
# Prompt shape
$GitPromptSettings.AfterText = " "
$GitPromptSettings.BeforeText = " "
$GitPromptSettings.BranchIdenticalStatusToSymbol = ""
$GitPromptSettings.DelimText = " ॥"
$GitPromptSettings.LocalStagedStatusSymbol = ""
$GitPromptSettings.LocalWorkingStatusSymbol = ""
$GitPromptSettings.ShowStatusWhenZero = $false
$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$windowsPrincipal = new-object 'System.Security.Principal.WindowsPrincipal' $windowsIdentity
if ($psISE) { $color = "Black"; }
elseif ($windowsPrincipal.IsInRole("Administrators") -eq 1) { $color = "Red"; }
else { $color = "Green"; }
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor
write-host " " -NoNewLine
Write-VcsStatus
write-host " " -NoNewLine
if ((get-location -stack).Count -gt 0) {
write-host (("+" * ((get-location -stack).Count))) -NoNewLine -ForegroundColor Cyan
write-host " " -NoNewLine
}
write-host "$" -NoNewLine -ForegroundColor $color
return " "
@bradwilson
Copy link
Author

Colors I use in ConEmu:

cr3qy-nveaabvqw

@stamminator
Copy link

Would you mind posting a brief recording/gif demoing your settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment