nathanaelkane/vim-indent-guides — Issue #33: Indent guides look ugly on 256-color terminal
Author: rmunn
Created: 2012-02-03 07:31:49+00:00
State: open

While the automatic coloring of indent guides looks great in gvim, it looks really ugly running vim on a 256-color terminal. Compare and contrast, for example, these two screenshots:

![Gvim](http://i.imgur.com/XbpGK.png)
![Vim 256 colors](http://i.imgur.com/qxmo1.png)

The color scheme in both screenshots is zenburn, and the code snippet is from indent_guides.vim. The rest of the colors match quite well, which makes the indent guides stand out like a sore thumb.

When I check ```:hi IndentGuidesOdd``` and ```:hi IndentGuidesEven``` in gvim, I see that they've been calculated as grey85 and grey70 respectively. After a little playing around (the [Xterm 256 color chart](http://excess.org/article/2007/10/xterm-256-colour-chart-20/) was a big help), I found that ``:hi IndentGuidesOdd ctermbg=236``` and ```:hi IndentGuidesEven ctermbg=240``` were decent matches for the guibg colors -- and indeed, when I set those values, my terminal VIm looks much better.

It would be nice if vim-indent-guides could detect a 256-color (or 88-color) terminal and calculate its grey values accordingly. The Python script at http://excess.org/article/2007/10/xterm-256-colour-chart-20/ might help: it shows that the greys in the Xterm 256 color chart are spread between 0xe8 (ctermbg=232) and 0xff (ctermbg=255), which means each increasing ctermbg number adds about 4% brightness overall. That should make the math reasonably simple for a 256-color terminal. (Afraid I can't help with the 88-color terminal math, as I don't have one of those handy to test with.)