I'm trying to add some color to my git configuration and I want to know what color names are available on the terminal.

  • I only want to use colors by name so it's easier for others to understand
  • I don't want to add any new colors - I just want to select from the predefined names
  • I would like a solution that works for all distros, but primarily Debian
  • It would be nice to see the color that the name indicates

Many online references often talk about color names that are not defined on my system, so I just need a way to see what my default options are.


2 Answers 2


Many online references often talk about color names that are not defined on my system

Those probably are defined, but they are X11 colors; once upon a time you could find them in /lib[64]/X11/rgb.txt. In any case, this is a mapping of strings (e.g., dimgray) to 24-bit RGB colors (e.g. 0xff8800 or #ff8800, which would be orange). A 24-bit space is ~16 million colors, obviously X11 does not give them all names (CSS 3 uses X11 names, BTW).

The 24-bit space is used by your GUI; transparency is implemented by increasing this to a 32-bit space. However, git isn't a GUI (G = graphical) tool, it's a TUI (T = terminal) tool, and it is limited to the colors available on a normal terminal.

I would like a solution that works for all distros, but primarily Debian

If you want this to be properly portable, you should rely only on the eight standard ANSI colors:

  • black
  • blue
  • green
  • yellow
  • cyan
  • white
  • magenta
  • red

A little disappointing next to the X11 list, but better than nothing at all! These also have a "bold" or "bright" version that is standard, making 16 colors, which you may be able to specify as, e.g., "brightyellow" (or conversely, "darkyellow").

Most GUI terminals1 have 256 color support and some terminal apps can exploit this. To test, you first need to set the $TERM variable appropriately:

export $TERM=xterm-256color

Your terminal emulator may also have a configuration option for this. Colors under the xterm 256 color protocol are indexed:

xterm color chart

The index number is in the bottom left corner. Notice the set at the bottom of this chart (0-15) is the 16 basic (bright and dark) ANSI colors. To reference one of these colors under the standard, you use color + the index number, eg. color40.

1. A "GUI terminal" is a terminal emulator that runs in a GUI context, such as xterm, the GNOME terminal, etc. However, this does not make TUI apps (such as git) running in a GUI terminal into GUI apps. They are still TUI apps and are bound by that context.

  • Sorry, the X11 list may have been misleading. I am not interested in any kind of GUI - just colors available on the terminal.
    – doub1ejack
    Dec 18, 2013 at 14:52
  • Well, there you have it. Presuming normal hardware, any terminal you encounter on linux has 16 colors, the eight above each with a "bright/bold" version as per the ANSI standard (although, e.g., usually only the bright yellow looks yellow; the normal one looks ochre, etc). So WRT to git, you can use those 8. My point was you can't use just any color you see on the screen. The terminal interface is a limitation. Eight basic colors. That's all.
    – goldilocks
    Dec 18, 2013 at 15:04
  • 2
    @doub1ejack : Guess what? I noticed yesterday that there is a standard for naming colors on 256-color terminals, and there are some TUI apps that use it, although I did not check git. Anyway, I've edited some stuff in about this.
    – goldilocks
    Jan 8, 2014 at 13:43
  • I think there are only 8 colors and 8 bright versions. Saying they are 16 colors is not technically correct?
    – jiggunjer
    Feb 23, 2017 at 9:32
  • 1
    I was reading this answer, waiting until I got to the how. I was nearly there, and the answer stopped. Jan 1, 2019 at 11:30

In CentOS you have showrgb:

showrgb - display an rgb color-name database

  • 2
    showrgb lists X colours, not terminal colours which is what is needed here. Jan 27, 2022 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .