Terminal Colors

The Colorful Dodecagon: yet another color scheme.

After searching for a while for a terminal color scheme with certain properties, I gave up and made my own. Here are the coveted goals:

• The contrast level should be neither too low (light gray text on a drark gray background is hard to read), nor too high (pure white text on a pure black background is a little much).
• All of the colors should be easily distinguishable.
• None of the colors should stand out from one another: they should all have about the same apparent brightness.

While this sounds pretty easy, it’s made more difficult by the fact that the RGB color space maps very poorly to what our eyes actually see. For instance, pure green on black is too bright, while pure blue on black is too dark.

The LAB color space largely solves this problem by being designed around perceived color: distances in LAB space approximate perceived color distance. It measured colors by a lightness axis (L) ranging from 0% (black) to 100% (white), a red-green axis (A) ranging from 128 (red) to -128 (green), and a blue-yellow axis (B) ranging from 128 (blue) to -128 (yellow). Interestingly, not all LAB colors can be converted to RGB; monitors that just display three colors can’t represent every color we can see.

The Colorful Dodecagon has 12 bright colors equally spaced in LAB space. They have a brightness of 74%, which maximizes how saturated the colors can be and still fit in RGB space. Its white has a brightness of 90%, and its black has a brightness of 10%. In the terminal, I use every other color from the Dodecagon, making all of the colors equidistant from white and from their neighbors (at a distance of 40 in LAB space).

The main color contenders for color schemes I found on the internet were Solarized and Base16. Solarized has an absurdly low contrast of like 40%: its zoomed-in screenshot looks pretty, but when you actually start coding in it it’s hard to read. Base16 is much better. My only complaints are that blue and teal are hard to distinguish (only 16 distance away in LAB space), and that the red is garish (it has a LAB brightness of ~40%, while the other colors have a brightness around ~70%).

``````COLOR_NAME L    A    B    HEX      TERMINAL
black      10   0    0    #1b1b1b  black
white      90   0    0    #e2e2e2  white
pink       74   40   0    #fa99b7
red        74   35   20   #fc9c93  red
orange     74   20   35   #eba676
yellow     74   0    40   #cdb36b  yellow
pear       74   -20  35   #a7be74
green      74   -35  20   #7ac68f  green
teal       74   -40  0    #48c9b4
cyan       74   -35  -20  #01c8d9  cyan
blue       74   -20  -35  #3ac3f5
indigo     74   0    -40  #80b9fe  blue
lavender   74   20   -35  #b9acf6
magenta    74   35   -20  #e49fdb  magenta
``````

If we allow colors to be brighter in exchange for some of the colors not being representable, and thus getting rounded, we get this next circle. Note that “pink” is a bit off, and “red” is quite off:

``````COLOR_NAME L    A    B    HEX      TERMINAL
black      10   0    0    #1b1b1b  black
white      90   0    0    #e2e2e2  white
pink       78   40   0    #ffa4c2
red        78   35   20   #ffa79e!  red
orange     78   20   35   #f8b281
yellow     78   0    40   #dabf76  yellow
pear       78   -20  35   #b3ca7f
green      78   -35  20   #86d19a  green
teal       78   -40  0    #56d5c0
cyan       78   -35  -20  #29d4e5  cyan
blue       78   -20  -35  #4bceff
indigo     78   0    -40  #80b9fe  blue
lavender   78   20   -35  #c5b7ff
magenta    78   35   -20  #f0aae7  magenta
``````

For an extremely in-depth overview of color, check out handprint.com.