1

I'm new to iTerm and vim and have been trying to follow readme at: https://github.com/chriskempson/base16-shell to try to get a theme to work in iTerm2/vim. The theme will only run if I chmod it and run it first then go to vim from there. On startup, iTerm will revert to the default theme in profiles. I have in ~/.config/base16-shell/

base16-shell.png
colortest
profile_helper.sh
scripts
setting-256-colourspace-not-supported.png
templates

When I run colortest it doesn't pass the test specified at the bottom of the page https://github.com/chriskempson/base16-shell. However, from there I go in /scripts and run base16-ocean.sh, the theme is run, and from there if I run colortest again it passes.

I have in my vimrc:

let base16colorspace=256
colorscheme base16-ocean

1 Answer 1

5

You have to run the script when your shell starts and it has to be ran from the base16-vim color scheme, which is tersely documented in base16-shell. But, you don't want to use that script. It'll just create more confusion later.

The "base 16" colors are the 8 standard colors + 8 brighter variants of those colors. base16's themes treat them as 16 distinct colors instead. All shell programs that use color expect these colors to be what's labeled below, but have no idea what the actual color is on your screen.

colors

Using base16 is fine if you're using a profile dedicated to Vim. Otherwise, you will get non-obvious results if you use other programs that have no awareness of this. For instance, if a program only uses the basic 8 colors and wants to display "bright green", it'll show up on your screen as a very dark gray, which won't be visible if you have a black background.

If your terminal supports palette customization (it does), the base16-shell script allows you to keep the standard 8 colors + 8 bright variants, but at the cost of changing five of the the 216 color palette. In the base16 Vim colorscheme, it will use colors 0-7 and 17-21, instead of 0-15.

Colors 17-21 are shades of blue, which is shown in the troubleshooting section of the README:

blues

Colors 16-231 are a fixed set of colors and programs that use this palette expect these colors to be constant. So, you'll also get unexpected results if 17-21 are used by anything other than Vim, which again, is fine if you are fully aware of this and use a separate profile just for Vim.

This was a clever approach, but IMO, gives little guidance to users and is far too much effort to alter a well established palette to get a pretty color scheme. For a little bit less effort, you can get the latest build of Vim (v7.4.1799+) or Neovim (v0.1.5 [dev]) and use the termguicolors setting to use the #rrggbb GUI colors instead since iTerm2 supports truecolor. Then you wouldn't be limited to 256 colors and can use any of the base16-vim color schemes without screwing up the shell's colors.

1
  • If I understand you correctly, I have to run base16-shell every time I open the terminal to have the colors available in vim? If not, what would be the steps to do so?
    – Babiker
    Jul 25, 2016 at 5:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.