1

does any of you know if there a way to apply git color with both bold and underline (or as a more general question - apply color with multiple style args)?

I try to set git config color.grep.filename to be green, bold and underline... It seems as if I can't do it and must choose between bold and underline.

I tried the obvious way and got an error

git config color.grep.filename green bold ul

then I tried this way and only ul passed through

git config color.grep.filename green bold
git config color.grep.filename ul

then I tried hardcoded like this and only one of them worked

git config --add color.grep.filename "green ul bold"

and lastly I tried this way and got only bold green to work

git config --add color.grep.filename ul
git config --add color.grep.filename green bold

Is there something I am missing or is it just not a possibility to combine?

Thanks for the help :D

Hacktivator
  • 63
  • 3
  • 7
  • Git implements colorized text and other effects (bold, inverse, underline) through escape sequences: ESC, `[`, digits, `m` (this is actually an ANSI standard!). It's up to your terminal emulator to turn these into actual displayed colors and effects. Your terminal emulation *may* (emphasis on may) have ways to make this work better, but this obviously depends on which terminal emulator you use. – torek Feb 21 '21 at 17:49
  • A lot of Mac users swear by iterm (in its various incarnations). I still just use plain old Terminal though. – torek Feb 21 '21 at 17:50
  • @torek I use ubuntu 18.04 native terminal (I believe its GNOME terminal) – Hacktivator Feb 22 '21 at 09:57

1 Answers1

0

Reading git config colors, I just tried:

git -c color.grep.filename="yellow ul bold" grep seec

It does work for yellow. Meaning I see a difference between "yellow ul" and "yellow ul bold".
But not for green or blue, in my Git for Windows session (CMD).
It might depend on your actual shell though.

  • yellow ul
    yellow ul

  • yellow ul bold or yellow bold ul
    yellow ul bold

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried that for my combination only and it didn't work (meaning I tried with green and not yellow). Anyways, im using ubuntu's shell so we might have a difference – Hacktivator Feb 21 '21 at 14:44
  • @Hacktivator Ubuntu shell in a WSL2 session on Windows? Or directly on Ubuntu host? Which version is your OS and Git? – VonC Feb 21 '21 at 14:50
  • @Hacktivator I have edited the answer to include pictures illustrating what I see with those attributes. – VonC Feb 21 '21 at 14:53
  • I use ubuntu 18.04 directly as host, no windows OS involved, and git v 2.17.1 @VonC – Hacktivator Feb 22 '21 at 09:55
  • @Hacktivator Can you try and upgrade to latest 2.30.1? – VonC Feb 22 '21 at 10:00