Ubuntu, Vim, and the solarized color palette

VimUbuntuColorsTerminal

Vim Problem Overview


I'd really like to get in on all the colorful goodness of the solarized colorscheme, but I can't seem to get it configured just right.

I have the main solarized file in my .vim/colors folder, I've set my terminal profile colors to what is listed on the site, and I've added the lines

 set background=dark
 let g:solarized_termcolors=16
 colorscheme solarized

to my .vimrc file, but Vim looks greyed out and is using a bright green color as the default. How can I do it?

Vim Solutions


Solution 1 - Vim

Here's my recommendation for things to try:

  1. ensure syntax on is in your .vimrc file
  2. Check what t_Co Vim has picked up from your term emulator (a quick :echo &t_Co). If it's 8, you'll want to se t_Co=16. You might also try se t_Co=256 though without let g:solarized_termcolors=16 this will use the 256 fallback mode, which isn't quite the correct color scheme.

Solution 2 - Vim

set t_Co=16 and let g:solarized_termcolors=16 did not work for me. This is what worked:

syntax on
let g:solarized_termcolors=256
set t_Co=256 
set background=dark
colorscheme solarized

Solution 3 - Vim

I found out how do do it from this article.

I wrote the following script to do the gnome-terminal stuff.

gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#00002B2B3636"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "#838394949696"

Solution 4 - Vim

If you are trying to use Vim with solarized inside of tmux, this is the fix for your issue:

Fix solarized theme in tmux

Solution 5 - Vim

Trying it out myself, it seems to work better without the

let g:solarized_termcolors=16

Setting it to 16, I get the bright green color you seem to describe. Maybe try leaving it at the default of 256?

This doesn't, however, perfectly mimic the colors from the screenshots (although the light version looks fairly close). I only get the colors with the screenshot if I use gVim.

I didn't use the terminal profile colors provided, however, so you may get a different result.

Solution 6 - Vim

For the copy and paste lovers, this is how you install the solarized Vim colorscheme on Ubuntu:

sudo apt-get install wget unzip curl
cd
wget http://ethanschoonover.com/solarized/files/solarized.zip
unzip solarized.zip
mkdir .vim
mkdir .vim/colors/
mv solarized/vim-colors-solarized/colors/solarized.vim ~/.vim/colors/
cp .vimrc .vimrc.old
echo "syntax enable" > .vimrc
echo "set background=dark" >> .vimrc
echo "colorscheme solarized" >> .vimrc
curl https://raw.github.com/seebi/dircolors-solarized/master/dircolors.256dark > ~/.dircolors
source .bashrc
rm -r solarized
rm solarized.zip

And presto.

Solution 7 - Vim

From the README (emphasis mine):

> ### IMPORTANT NOTE FOR TERMINAL USERS: > > If you are going to use Solarized in Terminal mode (i.e. not in a GUI > version like gvim or macvim), please please please consider > setting your terminal emulator's colorscheme to used the Solarized > palette. I've included palettes for some popular terminal emulator as > well as Xdefaults in the official Solarized download available from > [Solarized homepage]. If you use Solarized without these colors, > Solarized will need to be told to degrade its colorscheme to a set > compatible with the limited 256 terminal palette (whereas by using > the terminal's 16 ansi color values, you can set the correct, specific > values for the Solarized palette). > > If you do use the custom terminal colors, solarized.vim should work > out of the box for you. If you are using a terminal emulator that > supports 256 colors and don't want to use the custom Solarized > terminal colors, you will need to use the degraded 256 colorscheme. > To do so, simply add the following line before the colorschem > solarized line: > > let g:solarized_termcolors=256 > > Again, I recommend just changing your terminal colors to Solarized > values either manually or via one of the many terminal schemes > available for import.

Simply selecting Solarized for both "Text and Background Color" (choose light or dark) and "Palette" in TerminalPreferencesProfiles → (select yours) → EditColors worked for me on Ubuntu 16.04 (Xenial Xerus) with the included Terminal application.

Some other answers recommend choosing a 256 color palette but, as mentioned in the documentation, this gives you a degraded (and visibly worse in my opinion) color scheme.

Solution 8 - Vim

This worked for me for exherbo

git clone https://github.com/sigurdga/gnome-terminal-colors-solarized
cd gnome-terminal-colors-solarized
sh install.sh -s dark -p <my_current_profile>

256 colors in vim may also help

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondanwoodsView Question on Stackoverflow
Solution 1 - VimaltercationView Answer on Stackoverflow
Solution 2 - VimAnton JebrakView Answer on Stackoverflow
Solution 3 - Vimt-martView Answer on Stackoverflow
Solution 4 - VimosmosisView Answer on Stackoverflow
Solution 5 - VimJasonView Answer on Stackoverflow
Solution 6 - VimCookieView Answer on Stackoverflow
Solution 7 - VimPatrick SananView Answer on Stackoverflow
Solution 8 - VimrofrolView Answer on Stackoverflow