Change git status colors in Posh-Git

In Posh-Git , when I run the “git status” in the repository, the colors for changes and unplayable files are dark red when I tried to set them to “normal” red. I want to do this because I have a console with a dark background, so dark red is hard to read.

I searched around, and there seem to be two configuration changes that I needed to make:

  • Change the "WorkForegroundColor" and "UntrackedForegroundColor" from "DarkRed" to "Red" in the settings of $ GitPromptSettings.

  • Change "color.status.changed" and "color.status.untracked" to red in the git configuration.

From my reading that all I need to do, and yet the results of the “git status” remain dark red.

Here is a summary to prove that I installed them, as I claimed, and maybe someone might find the error:

screenshot

+44
git windows-7 powershell posh-git
Aug 24 '13 at 15:27
source share
5 answers

There is only one way to change DarkRed to Red here: change the color scheme of the console window itself. As far as I know, git will select the "first" red list (which is dark ...). So just increase the R value for it.

You can do this directly in the window (Properties → Colors) or in the registry. Hint is another story: it uses PS color names where Red = Red, not DarkRed ...

+33
Aug 25 '13 at 9:00
source share

The output of git status controlled by your .gitconfig file. The default for changed and untracked is dim Red , but you most likely want Red Bold , which is the bright (default) red that you have in the tooltip.

Add the following to your .gitconfig file:

 [color] ui = true [color "status"] changed = red bold untracked = red bold added = green bold 

For others referring to this in the future, the accepted colors are normal , black , Red , green , yellow , blue , magenta , cyan and white , as well as one optional modifier bold , dim , ul , blink or reverse . If two colors are specified, the first is the foreground and the second is the background.

+69
Apr 09 '14 at 6:53 on
source share

To change the color of the listed unrestored and modified files to a more readable yellow color, you can add this to your ~ / .gitconfig file:

 [color "status"] untracked = bold yellow changed = bold yellow 

Also updating GitPrompt.ps1 to show that there are no traces as yellow, this is probably a good idea:

  UntrackedForegroundColor = [ConsoleColor]::Yellow WorkingForegroundColor = [ConsoleColor]::Yellow 

Edit: GitPrompt.ps1 is located in the PowerShell posh-git folder.

+8
Dec 05 '13 at 8:40
source share

You can change them by changing the source of the GitPrompt.ps1 file in the PowerShell module posh-git folder. I had the same problem and just deleted “Dark” in the colors defined on line 30 in this file:

 BeforeIndexForegroundColor= [ConsoleColor]::**Green** BeforeIndexBackgroundColor= $Host.UI.RawUI.BackgroundColor IndexForegroundColor = [ConsoleColor]::**Green** IndexBackgroundColor = $Host.UI.RawUI.BackgroundColor WorkingForegroundColor = [ConsoleColor]::**Red** WorkingBackgroundColor = $Host.UI.RawUI.BackgroundColor UntrackedText = ' !' UntrackedForegroundColor = [ConsoleColor]::**Red** 

This Powershell color list is also useful.

+4
Oct 31 '13 at 20:17
source share

Except the answer @WarrenB. To change the color of the status and the colors of git diff (new lines and deleted lines), you should have this in your .git / config file:

 [color] ui = true [color "status"] changed = red bold untracked = red bold added = green bold [color "diff"] old = red bold new = green bold 

The "diff" option allows you to have bright (bold) reds and greens. Link: https://git-scm.com/docs/git-config#git-config-colordiff

0
Jul 10 '17 at 16:03
source share



All Articles