How can I change a specific font color in git?
Asked Answered
B

4

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.

Burchfield answered 7/3, 2011 at 23:36 Comment(0)
R
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.

Rhotacism answered 7/3, 2011 at 23:46 Comment(6)
Indeed, pink is not valid. Alternatively, you can also make it bold or change the background color instead (source: man page)Sthenic
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.Burchfield
how do you know the output category? I mean how did you know to use "color.status.untracked" ?Nobles
@AlexAngelico man git-config has a list of most of Git’s configuration variables.Rhotacism
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 .Workwoman
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"Rich
P
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.

Prostomium answered 7/3, 2011 at 23:40 Comment(0)
F
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
Fabriane answered 4/4, 2017 at 8:23 Comment(0)
B
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

Bruin answered 24/9, 2015 at 7:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.