From 2ef165c2e7aa10ad0237f1ec7f02de118042934c Mon Sep 17 00:00:00 2001 From: Lifepillar Date: Sat, 11 Nov 2017 13:29:45 +0100 Subject: [PATCH] Update Readme. --- Readme.md | 91 ++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 51 deletions(-) diff --git a/Readme.md b/Readme.md index f1cd681..cc55991 100644 --- a/Readme.md +++ b/Readme.md @@ -14,23 +14,34 @@ 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 terminals. Instead, this color scheme -works **out of the box** if you use: +works **out of the box everywhere**. For the best experience, you need: - Vim ≥7.4.1799 with `termguicolors` set, or - NeoVim, -**and** a true-color enabled terminal (e.g., [iTerm2](https://www.iterm2.com)). -Solarized 8 also works in MacVim, gVim, etc…: no configuration is needed. +**and** a true-color enabled terminal. Solarized 8 also works in MacVim, gVim, +etc…: no configuration is needed. -For terminals not supporting true colors, you have two possibilities: +**Note:** for terminals not supporting true colors, Solarized 8 will fall back +to use an approximate palette based on xterm's 256 colors. This is a very crude +approximation, which looks more or less like this: + +![Solarized 8 Dark 256](https://raw.github.com/lifepillar/Resources/master/solarized8/solarized8_dark_256.png) + +![Solarized 8 Light 256](https://raw.github.com/lifepillar/Resources/master/solarized8/solarized8_light_256.png) + +To get exact colors with such terminals, you must set your terminal's 16 ANSI +colors to the Solarized palette (refer to the manual of your terminal) and put +this line in your `vimrc` before loading the colorscheme: -1. set your terminal's 16 ANSI color to the Solarized palette, or -2. use an approximate palette based on xterm's 256 colors. To do so, put this in - your `vimrc`: ```vim - let g:solarized_use16 = 0 + let g:solarized_use16 = 1 ``` +Be aware that, if you set the variable above, but your terminal does not use the +Solarized palette, your colors will be completely off. + + ## Installation If your Vim supports packages (`echo has('packages')` prints `1`), I strongly @@ -41,20 +52,25 @@ recommend that you use them. Just clone this repo inside `pack/*/opt`, e.g.: Otherwise, use your favourite installation method. -There are actually 8 optimized color schemes: +There are actually 4 optimized color schemes: -- `solarized8_dark` and `solarized8_light`: the default Solarized theme; -- `solarized8_dark_low` and `solarized8_light_low`: low-contrast variant; -- `solarized8_dark_high` and `solarized8_light_high`: high-contrast variant; -- `solarized8_dark_flat` and `solarized8_light_flat`: “flat” variant (not - present in the original Solarized, see screenshots above). +- `solarized8`: the default Solarized theme; +- `solarized8_low`: low-contrast variant; +- `solarized8_high`: high-contrast variant; +- `solarized8_flat`: “flat” variant (not present in the original Solarized, see + screenshots above). -To use any of them, put a line like the following in your `.vimrc`: +To use any of them, set the background (`dark` or `light`) then load the +colorscheme, e.g.: - colorscheme solarized8_dark + set background=dark + colorscheme solarized8 -**Note:** if you use Vim packages, there is no need to `packadd solarized8`. -Keep your `runtimepath` clean! +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! ## Options @@ -76,11 +92,9 @@ The following options were not available in the original Solarized: 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_use16`: see above. -Besides, you may choose which terminal palette to use with `g:solarized_use16`, -as mentioned above. - -All these options may be used with any `solarized8_*` variant. +All these options may be used with any Solarized 8 variant. ## Troubleshooting @@ -98,37 +112,12 @@ let &t_8b = "\[48;2;%lu;%lu;%lum" See `:h xterm-true-color` for the details. -## Tips - -If you want to quickly toggle between dark and light background, you may define -a mapping like the following: - -```viml -nnoremap B :exe "colors" (g:colors_name =~# "dark" - \ ? substitute(g:colors_name, 'dark', 'light', '') - \ : substitute(g:colors_name, 'light', 'dark', '') - \ ) -``` - -To tune the contrast level you may use the following snippet: - -```viml -fun! Solarized8Contrast(delta) - let l:schemes = map(["_low", "_flat", "", "_high"], '"solarized8_".(&background).v:val') - exe "colors" l:schemes[((a:delta+index(l:schemes, g:colors_name)) % 4 + 4) % 4] -endf - -nmap - :call Solarized8Contrast(-v:count1) -nmap + :call Solarized8Contrast(+v:count1) -``` - ## Hacking -Do you want to hack the theme? Install the -[Colortemplate](https://github.com/lifepillar/vim-colortemplate) ftplugin, -edit the `*.colortemplate` files, then rebuild the colorschemes using the -script in the `templates` folder. +Do you want to hack the theme? Install +[Colortemplate](https://github.com/lifepillar/vim-colortemplate), edit the +`*.colortemplate` files, then rebuild the colorschemes using the script in the +`templates` folder. If you extend or improve Solarized8, please consider submitting a pull request! -