20

I'm looking to change the 'red' font color in git to something that is more towards pink. I tend to keep my monitors pretty dim, and whenever I look through diffs, the red font on the black background is hard to read. So, is there a way to specify that I want it to use a different color for red, preferably using a single command?

I'm using msysgit with MINGW32 on Win7.

camerb
  • 247
  • 2
  • 7

4 Answers4

22
git config --global color.status.updated magenta
git config --global color.status.changed magenta
git config --global color.status.untracked magenta
git config --global color.diff.old magenta

Substitute ”magenta” for whatever color desired. See the git-config documentation for more details.

Michael
  • 11
  • 3
Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
  • 4
    Indeed, pink is not valid. Alternatively, you can also make it bold or change the background color instead (source: man page) – Simon Mar 08 '11 at 01:26
  • 1
    I had a feeling that it would be the "git config" command. I went ahead and opened up the config with "git config --edit" and set those commands to have a red background and a white foreground. Maybe someday I'll switch to console2 or something that will allow me to configure my console colors better, but for now, this is good enough. – camerb Mar 11 '11 at 14:26
  • how do you know the output category? I mean how did you know to use "color.status.untracked" ? – Alex Angelico Apr 16 '13 at 19:15
  • 1
    @AlexAngelico [`man git-config`](https://www.kernel.org/pub/software/scm/git/docs/git-config.html#_variables) has a list of most of Git’s configuration variables. – Andrew Marshall Apr 16 '13 at 23:49
  • 1
    The accepted values are two of normal , black , red , green , yellow , blue , magenta , cyan and white and optionally one of bold , dim , ul , blink and reverse . – ajdeguzman Oct 16 '14 at 06:03
  • Some terminals do not support magenta and change the text to white instead. To use bright red instead of the default dark red, use the 'bold' keyword after the foreground and background values, all within quotes. `git config --global color.diff.old "red black bold"` – jk7 Jan 09 '21 at 00:48
3

I believe Git just uses terminal color codes... so you'd need to change your terminal's ANSI color code mappings to a different color. The method of doing this (and whether it's even possible) varies depending on the terminal.

Amber
  • 507,862
  • 82
  • 626
  • 550
1

I think Andrew's answer is not 100% accurate, color.status.updated default color is green not red. So my answer would be:

git config --global color.status.changed magenta
git config --global color.status.untracked magenta
git config --global color.diff.old magenta
Fred H.
  • 44
  • 5
0

Perhaps check your terminal profile colours are not set to "share system theme" and ensure your terminal background is black.

I just read this and discovered mine was some shade of almost black but actually quite light which i never noticed

Jay Day Zee
  • 602
  • 6
  • 8