Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Color UI support for 256 Colors?

I am trying to colour my Git output using my native XTerm 256 color palette. Is there anyway to do this? I can't seem to get it to work.

for example in .gitconfig.

[color]
  ui = auto
[color 'branch']
  local = colour33
  remote = colour46
  current = colour27

Etc.
I know this formatting works when you specify the various basic color terms; cyan, magenta, yellow, and attributes; dim, bright, ul, bold, etc.
But I just can't find anything in regards to using the full color palette available to a 256color terminal, without actually changing the 8 basic color terms themselves, in the actual pallete.
There isn't anything in the documentation or manpages that I can find either.
I know different programs seem to use different syntax for specifying color, so I may just be using the wrong syntax or I am the only one who has ever wanted to do such a thing.

I am assuming git-config will only support those basic 8 colors with various attributes based on what the git-config man page is saying, so if this is not possible, is there a way to change those colors, in the terminals color palette BUT only for one program, like in this situation, Git? Maybe a perl script that exports those values only when git-config is referencing them, but unsets them soon as git-config is finished?

And no this is not too much trouble than its worth. I love my eyecandy in a terminal, and id do it myself if I could figure out a resource that explains something similar.

like image 260
CJD14 Avatar asked Feb 03 '14 23:02

CJD14


People also ask

Can only support 256 colors?

GIF (.GIF or Graphics Interchange Format files are widely used for web graphics, because they are limited to only 256 colors, can allow for transparency, and can be animated.

What is color UI in git?

The color. ui is a meta configuration that includes all the various color. * configurations available with git commands.

What do the colors mean in github?

To summarize: Cyan means the branch matches its remote. Green means the branch is ahead of its remote (green light to push) Red means the branch is behind its remote. Yellow means the branch is both ahead of and behind its remote.


1 Answers

The syntax for the color is: [fg [bg]] [attr]...

As for the colors, you can use the named ones (normal, black, red, green, yellow, blue, magenta, cyan, and white) or just a number of the color in the 256 palette without any prefix.

The supported attributes are: bold, dim, ul, blink, and reverse.

So your configuration might look like this (tested with git 1.8.5.3):

[color "branch"]
    local = 33 
    remote = 46
    current = 27

I have taken a look into the git source code to find the answer.

like image 194
Jan Včelák Avatar answered Sep 27 '22 18:09

Jan Včelák