• Stars
    star
    1,008
  • Rank 45,589 (Top 0.9 %)
  • Language
    Vim Script
  • Created over 8 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Optimized Solarized colorschemes. Best served with true-color terminals!

Solarized 8 for Vim

Solarized 8 Flat Dark Solarized 8 Flat Light

Note: if you are using Neovim, checkout the neovim branch of this repo.

This is yet another Solarized theme for Vim. It places itself half way between the original Solarized and the Flattened variant. It removes only some of the bullshit. The color palette is exactly the same as in Solarized, although some highlight groups are defined slightly differently (for instance, I have tried to avoid red on blue).

The main reason for the existence of this project is that the original Solarized theme does not define guifg and guibg in terminal Vim, making it unsuitable for versions of Vim supporting true-color (i.e., 24-bit color) terminals. Instead, this color scheme works out of the box everywhere. For the best experience, you need:

  • Vim ≥7.4.1799 with termguicolors set, and
  • a terminal supporting millions of colors (but see below for workarounds).

Solarized 8 also works in any GUI version of Vim: no configuration is necessary.* See below for installation instructions.

* VimR users must set termguicolors before loading the color scheme.

But, my terminal has only 256 colors!

For terminals not supporting true colors, Solarized 8 will fall back to use an approximate palette based on xterm's 256 colors, which looks more or less like this:

Dark 256 color palette Light 256 color palette

(Yeah, it looks like a different color scheme: Solarized palette is far away from xterm colors!)

If you do not like this approximation, to get exact colors with such terminals you have two possibilities:

  1. Modify some of your terminal colors in the range 16–255 to match Solarized palette. For this purpose, you may run (not source!) scripts/solarized8.sh; no setting is needed in Vim. For instance, if you are using Bash, put this in .bashrc:

    sh /path/to/scripts/solarized.sh

    Note: this method is supported only by some, but not all, terminals. For instance, in Apple's Terminal.app, running solarized.sh has no effect.

  2. Set your terminal's 16 ANSI colors (the colors in the range 0–15) to the Solarized palette (how to do that depends on the terminal) and set t_Co=16 in Vim to instruct Vim to use your terminal's colors. Be aware that, if you force the use of your terminal colors in Vim with any of these settings, but your terminal is not configured to use the Solarized palette, your colors will be completely off!

Note: whatever method you choose, keep in mind that if your terminal does not support millions of colors, you must not set termguicolors (i.e., make sure that set termguicolors? outputs notermguicolors).

What if I happen to work on vt100 or similar?

In the past, Solarized 8 used to complain when your terminal did not support enough colors. But the current version will gracefully degrade to a (beautiful!) black&white color scheme:

Solarized 8 B&W variant Solarized 8 B&W variant

Installation

If your Vim supports packages (echo has('packages') prints 1), I strongly recommend that you use them. Just clone this repo inside pack/*/opt, e.g.:

git clone https://github.com/lifepillar/vim-solarized8.git \
    ~/.vim/pack/themes/opt/solarized8

Otherwise, use you favourite installation method.

There are actually four optimized* color schemes you may load:

  • solarized8_high: high-contrast variant (screenshow below, first column);
  • solarized8: the default Solarized theme (screenshot below, second column);
  • solarized8_low: low-contrast variant (screenshow below, third column);
  • solarized8_flat: “flat” variant (screenshow below, fourth column).

The “flat” variant does not exist in the original Solarized. It differs from solarized8 mainly in how the status line, split bars and tab bar look like:

To use a Solarized 8 color scheme, set the background (dark or light) then load the variant you want, e.g.:

set background=dark
colorscheme solarized8

If you opt to use some Vim plugin manager instead, the following should be added to your vimrc, rather than the above, for the color scheme to be loaded correctly:

set background=dark
autocmd vimenter * ++nested colorscheme solarized8

To switch the background from dark to light or vice versa, just set background accordingly.

If you use Vim packages, there is no need to packadd solarized8. Keep your runtimepath clean!

* Below is the result of a benchmark I have made using Vim 8.1.1450 and iTerm 2 v3.2.6 on a MacBook Pro Early 2015 with macOS 10.14.5. To make the comparison meaningful, g:solarized_extra_hi_groups was set to 1: Solarized 8 should load a bit faster if you do not enable additional syntax items. Note that Solarized 8 is optimized for what are believed to be the most common use cases, i.e., GUI, true-color terminals and 256-color terminals.

Options

The following options are inherited from Solarized:

  • g:solarized_visibility: one of "normal" (default), "low", "high";
  • g:solarized_diffmode: one of "normal" (default), "low", "high";
  • g:solarized_termtrans: make terminal background transparent if set to 1 (default: 0).

The following options were not available in the original Solarized:

  • g:solarized_statusline: one of "normal" (default), "low" or "flat";
  • g:solarized_italics: set to 0 to suppress italics (default is 1).
  • g:solarized_old_cursor_style: set to 1 if you want to use the original Solarized's cursor style (default: 0). By default, the cursor is orange/red in light themes, and blue in dark themes (but please note that your terminal may override the cursor's color).
  • g:solarized_extra_hi_groups: set to 1 to enable Solarized filetype-specific syntax highlighting groups (default is 0). Please be aware that if your Vim is not recent enough you may encounter an issue with syntax items defined in color schemes.

All these options may be used with any Solarized 8 variant.

Troubleshooting

Hey, I do not get the right colors when running Vim inside tmux or in my favourite true-color enabled terminal!

Try putting this in your .vimrc:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

See :h xterm-true-color for the details.

It may also be necessary to add the following to your tmux.conf:

# Add truecolor support
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Default terminal is 256 colors
set -g default-terminal "screen-256color"

See the discussion here for context.

Hacking

Do you want to hack the theme? Install Colortemplate, edit the templates/*.colortemplate files, then rebuild the color schemes.

If you extend or improve Solarized 8, please consider submitting a pull request!

More Repositories

1

vim-colortemplate

The Toolkit for Vim Color Scheme Designers!
Vim Script
920
star
2

vim-mucomplete

Chained completion that works the way you want!
Vim Script
912
star
3

vim-gruvbox8

A simplified and optimized Gruvbox colorscheme for Vim
Vim Script
528
star
4

CSVKeychain

Import/export between Apple Keychain.app and plain CSV file.
AppleScript
349
star
5

pgsql.vim

The best PostgreSQL plugin for Vim!
Vim Script
271
star
6

vim-cheat40

A Vim cheat sheet that makes sense, inside Vim!
Vim Script
247
star
7

vim-wwdc16-theme

Colorful dark color scheme for Vim inspired by Apple's WWDC16 page
Vim Script
102
star
8

homebrew-appleii

Homebrew formulae for anything related to Apple I, Apple II, Apple ///, and Apple IIGS emulators.
Ruby
54
star
9

vim-outlaw

The wanted outliner!
Vim Script
46
star
10

vim-wwdc17-theme

Colorful light color scheme for Vim inspired by Apple's WWDC17 page
Vim Script
39
star
11

vimrc

My personal Vim configuration.
Vim Script
34
star
12

ASUnit

AppleScript unit testing framework (originally written by Nir Soffer)
AppleScript
34
star
13

csv2keepassxml

Convert CSV files into KeePass 2 XML files.
Ruby
33
star
14

ledger2html

Process Ledger output to produce HTML5 reports.
Ruby
27
star
15

vim-zeef

Because you need to filter, but you want to do it your way!
Vim Script
19
star
16

nanoc4-template

A template for a site built with Nanoc 4 (http://nanoc.ws/), especially suited for blogs.
Ruby
16
star
17

Ledger.tmbundle

TextMate support for Ledger 3 (http://www.ledger-cli.org)
Ruby
10
star
18

ASMake

An AppleScript build library
AppleScript
10
star
19

middleman-by-lifepillar

A Middleman Template [OBSOLETE]
Ruby
9
star
20

dotfiles

🏡 My dotfiles… finally!
Shell
9
star
21

vim-formal-package

Vim package supporting various formal languages.
Vim Script
7
star
22

vim-devel

The workbench for modern Vim development
Vim Script
7
star
23

vim-keysound

Turn Vim into a typewriter!
Vim Script
6
star
24

vim8-colorschemes

Temporary repository for reworked Vim color schemes
Vim Script
4
star
25

vim-ucf

User completion functions for Vim
Vim Script
4
star
26

drupid

The not-so-smart Drupal updater that keeps your Drupal platform in sync with a Drush makefile!
Ruby
2
star
27

vim-context-metapost

Development line of the ConTeXt and MetaPost scripts distributed with Vim.
Vim Script
2
star
28

typewriter-sounds

Some typewriter sounds from various sources
2
star
29

awesome-data-not-collected-ios

1
star
30

sqlite3decimal-mirror

Mirror of https://chiselapp.com/user/lifepillar/repository/sqlite3decimal
C
1
star