Update Readme.

This commit is contained in:
Lifepillar
2017-11-11 13:29:45 +01:00
parent 5b41b09d30
commit 2ef165c2e7

View File

@@ -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 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 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 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 - Vim ≥7.4.1799 with `termguicolors` set, or
- NeoVim, - NeoVim,
**and** a true-color enabled terminal (e.g., [iTerm2](https://www.iterm2.com)). **and** a true-color enabled terminal. Solarized 8 also works in MacVim, gVim,
Solarized 8 also works in MacVim, gVim, etc…: no configuration is needed. 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 ```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 ## Installation
If your Vim supports packages (`echo has('packages')` prints `1`), I strongly 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. 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`: the default Solarized theme;
- `solarized8_dark_low` and `solarized8_light_low`: low-contrast variant; - `solarized8_low`: low-contrast variant;
- `solarized8_dark_high` and `solarized8_light_high`: high-contrast variant; - `solarized8_high`: high-contrast variant;
- `solarized8_dark_flat` and `solarized8_light_flat`: “flat” variant (not - `solarized8_flat`: “flat” variant (not present in the original Solarized, see
present in the original Solarized, see screenshots above). 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`. To switch the background from dark to light or vice versa, just set `background`
Keep your `runtimepath` clean! accordingly.
If you use Vim packages, there is no need to `packadd solarized8`. Keep your
`runtimepath` clean!
## Options ## 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 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 in light themes, and blue in dark themes (but please note that your terminal
may override the cursor's color). may override the cursor's color).
- `g:solarized_use16`: see above.
Besides, you may choose which terminal palette to use with `g:solarized_use16`, All these options may be used with any Solarized 8 variant.
as mentioned above.
All these options may be used with any `solarized8_*` variant.
## Troubleshooting ## Troubleshooting
@@ -98,37 +112,12 @@ let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
See `:h xterm-true-color` for the details. 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 <leader>B :<c-u>exe "colors" (g:colors_name =~# "dark"
\ ? substitute(g:colors_name, 'dark', 'light', '')
\ : substitute(g:colors_name, 'light', 'dark', '')
\ )<cr>
```
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 <leader>- :<c-u>call Solarized8Contrast(-v:count1)<cr>
nmap <leader>+ :<c-u>call Solarized8Contrast(+v:count1)<cr>
```
## Hacking ## Hacking
Do you want to hack the theme? Install the Do you want to hack the theme? Install
[Colortemplate](https://github.com/lifepillar/vim-colortemplate) ftplugin, [Colortemplate](https://github.com/lifepillar/vim-colortemplate), edit the
edit the `*.colortemplate` files, then rebuild the colorschemes using the `*.colortemplate` files, then rebuild the colorschemes using the script in the
script in the `templates` folder. `templates` folder.
If you extend or improve Solarized8, please consider submitting a pull request! If you extend or improve Solarized8, please consider submitting a pull request!