diff --git a/Readme.md b/Readme.md index 4a93b04..bddf1f2 100644 --- a/Readme.md +++ b/Readme.md @@ -1,37 +1,31 @@ -# Solarized 8: True Colors +# Solarized 8 for Neovim Solarized 8 Flat Dark | Solarized 8 Flat Light :-------------------------:|:-------------------------: ![](https://raw.github.com/lifepillar/Resources/master/solarized8/solarized8_dark_flat.png) | ![](https://raw.github.com/lifepillar/Resources/master/solarized8/solarized8_light_flat.png) -This is yet another Solarized theme for Vim. It places itself half way between +This is yet another Solarized theme for Neovim. It places itself half way between the original [Solarized](https://github.com/altercation/vim-colors-solarized) and the [Flattened](https://github.com/romainl/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: +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 Neovim and capable terminals. Instead, this color scheme works +**out of the box everywhere**. For the best experience, you need: -- Vim ≥7.4.1799, or NeoVim, with `termguicolors` set, **and** +- NeoVim 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](https://github.com/qvacua/vimr) users must set -`termguicolors` before loading the color scheme. +## But, my terminal does not have millions of colors! - -## 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: +For terminals not supporting true colors, set `g:solarized_t_Co` to the number +of colors available in your terminal. If that variable is set to `256` then +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 :-------------------------:|:-------------------------: @@ -40,10 +34,10 @@ 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: +If you do not like this approximation or if you want to force the use of the 16 +terrminal's ANSI colors, do one of the following: -1. Modify some of your terminal colors in the range 16–255 to match Solarized +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`: @@ -56,11 +50,11 @@ you have two possibilities: 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 (or `let g:solarized_use16=1`) to instruct Vim to use your + Solarized palette (how to do that depends on the terminal) *and* add + `let g:solarized_t_Co=16` to your `vimrc` to instruct Neovim 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! + colors in Neovim, 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 @@ -71,7 +65,7 @@ sure that `set termguicolors?` outputs `notermguicolors`). 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: +black&white color scheme. Just `let g:solarized_t_Co=0`: Solarized 8 B&W variant | Solarized 8 B&W variant :-------------------------:|:-------------------------: @@ -80,11 +74,13 @@ 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.: +I strongly recommend that you use Vim packages. Just clone this repo inside +`pack/*/opt` and checkout the `neovim` branch: git clone https://github.com/lifepillar/vim-solarized8.git \ - ~/.vim/pack/themes/opt/solarized8 + ~/.vim/pack/themes/start/solarized8 + cd ~/.vim/pack/themes/start/solarized8 + git checkout neovim Otherwise, use you favourite installation method. @@ -154,7 +150,7 @@ 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`: set to `1` to force using your 16 ANSI terminal colors. +- `g:solarized_t_Co`: set to the number of colors your terminal supports. - `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 @@ -164,36 +160,10 @@ The following options were not available in the original Solarized: 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`: - -```viml -let &t_8f = "\[38;2;%lu;%lu;%lum" -let &t_8b = "\[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](https://github.com/lifepillar/vim-solarized8/issues/4#issuecomment-985416964) for context. - - ## Hacking Do you want to hack the theme? Install -[Colortemplate](https://github.com/lifepillar/vim-colortemplate), edit the +[Colortemplate v2](https://github.com/lifepillar/vim-colortemplate), edit the `templates/*.colortemplate` files, then rebuild the color schemes. If you extend or improve Solarized 8, please consider submitting a pull request! diff --git a/colors/solarized8.vim b/colors/solarized8.vim index a9972ad..3ca1a11 100644 --- a/colors/solarized8.vim +++ b/colors/solarized8.vim @@ -4,22 +4,24 @@ " Maintainer: Lifepillar " Website: https://github.com/lifepillar/vim-solarized8 " License: OSI approved MIT license -" Last Updated: Tue Mar 29 13:47:13 2022 +" Last Updated: Tue Jun 6 14:37:46 2023 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.1 hi clear let g:colors_name = 'solarized8' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = has('gui_running') ? -1 : get(g:, 'solarized_t_Co', get(g:, 't_Co', exists('&t_Co') ? +&t_Co : 0)) let s:italics = (&t_ZH != '' && &t_ZH != '') || has('gui_running') || has('nvim') -let s:t_Co = get(g:, 'solarized_use16', 0) ? 16 : s:t_Co let s:italics = s:italics && get(g:, 'solarized_italics', 1) let s:termtrans = get(g:, 'solarized_termtrans', 0) && !has('gui_running') hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement +hi! link CurSearch Search +hi! link CursorLineFold FoldColumn +hi! link CursorLineSign SignColumn hi! link Debug Special hi! link Define PreProc hi! link Delimiter Special @@ -29,6 +31,8 @@ hi! link Function Identifier hi! link Include PreProc hi! link Keyword Statement hi! link Label Statement +hi! link LineNrAbove LineNr +hi! link LineNrBelow LineNr hi! link Macro PreProc hi! link Number Constant hi! link Operator Statement @@ -44,6 +48,8 @@ hi! link String Constant hi! link Structure Type hi! link Tag Special hi! link Typedef Type +hi! link debugBreakpoint SignColumn +hi! link debugPC SignColumn hi! link lCursor Cursor if &background ==# 'dark' @@ -2434,4 +2440,4 @@ endif " Term Colors: base2 red green yellow blue magenta cyan base02 " Term Colors: base3 orange base1 base0 base00 violet base01 base03 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/colors/solarized8_flat.vim b/colors/solarized8_flat.vim index 201de7a..0e67bbe 100644 --- a/colors/solarized8_flat.vim +++ b/colors/solarized8_flat.vim @@ -4,22 +4,24 @@ " Maintainer: Lifepillar " Website: https://github.com/lifepillar/vim-solarized8 " License: OSI approved MIT license -" Last Updated: Tue Mar 29 13:47:15 2022 +" Last Updated: Tue Jun 6 14:37:48 2023 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.1 hi clear let g:colors_name = 'solarized8_flat' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = has('gui_running') ? -1 : get(g:, 'solarized_t_Co', get(g:, 't_Co', exists('&t_Co') ? +&t_Co : 0)) let s:italics = (&t_ZH != '' && &t_ZH != '') || has('gui_running') || has('nvim') -let s:t_Co = get(g:, 'solarized_use16', 0) ? 16 : s:t_Co let s:italics = s:italics && get(g:, 'solarized_italics', 1) let s:termtrans = get(g:, 'solarized_termtrans', 0) && !has('gui_running') hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement +hi! link CurSearch Search +hi! link CursorLineFold FoldColumn +hi! link CursorLineSign SignColumn hi! link Debug Special hi! link Define PreProc hi! link Delimiter Special @@ -29,6 +31,8 @@ hi! link Function Identifier hi! link Include PreProc hi! link Keyword Statement hi! link Label Statement +hi! link LineNrAbove LineNr +hi! link LineNrBelow LineNr hi! link Macro PreProc hi! link Number Constant hi! link Operator Statement @@ -44,6 +48,8 @@ hi! link String Constant hi! link Structure Type hi! link Tag Special hi! link Typedef Type +hi! link debugBreakpoint SignColumn +hi! link debugPC SignColumn hi! link lCursor Cursor if &background ==# 'dark' @@ -2332,4 +2338,4 @@ endif " Term Colors: base2 red green yellow blue magenta cyan base02 " Term Colors: base3 orange base1 base0 base00 violet base01 base03 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/colors/solarized8_high.vim b/colors/solarized8_high.vim index 53c90ee..132e33d 100644 --- a/colors/solarized8_high.vim +++ b/colors/solarized8_high.vim @@ -4,22 +4,24 @@ " Maintainer: Lifepillar " Website: https://github.com/lifepillar/vim-solarized8 " License: OSI approved MIT license -" Last Updated: Tue Mar 29 13:47:17 2022 +" Last Updated: Tue Jun 6 14:37:51 2023 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.1 hi clear let g:colors_name = 'solarized8_high' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = has('gui_running') ? -1 : get(g:, 'solarized_t_Co', get(g:, 't_Co', exists('&t_Co') ? +&t_Co : 0)) let s:italics = (&t_ZH != '' && &t_ZH != '') || has('gui_running') || has('nvim') -let s:t_Co = get(g:, 'solarized_use16', 0) ? 16 : s:t_Co let s:italics = s:italics && get(g:, 'solarized_italics', 1) let s:termtrans = get(g:, 'solarized_termtrans', 0) && !has('gui_running') hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement +hi! link CurSearch Search +hi! link CursorLineFold FoldColumn +hi! link CursorLineSign SignColumn hi! link Debug Special hi! link Define PreProc hi! link Delimiter Special @@ -29,6 +31,8 @@ hi! link Function Identifier hi! link Include PreProc hi! link Keyword Statement hi! link Label Statement +hi! link LineNrAbove LineNr +hi! link LineNrBelow LineNr hi! link Macro PreProc hi! link Number Constant hi! link Operator Statement @@ -44,6 +48,8 @@ hi! link String Constant hi! link Structure Type hi! link Tag Special hi! link Typedef Type +hi! link debugBreakpoint SignColumn +hi! link debugPC SignColumn hi! link lCursor Cursor if &background ==# 'dark' @@ -2410,4 +2416,4 @@ endif " Term Colors: base2 red green yellow blue magenta cyan base02 " Term Colors: base3 orange base1 base0 base00 violet base01 base03 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/colors/solarized8_low.vim b/colors/solarized8_low.vim index 919e23c..77138a7 100644 --- a/colors/solarized8_low.vim +++ b/colors/solarized8_low.vim @@ -4,22 +4,24 @@ " Maintainer: Lifepillar " Website: https://github.com/lifepillar/vim-solarized8 " License: OSI approved MIT license -" Last Updated: Tue Mar 29 13:47:19 2022 +" Last Updated: Tue Jun 6 14:37:53 2023 -" Generated by Colortemplate v2.2.0 +" Generated by Colortemplate v2.2.1 hi clear let g:colors_name = 'solarized8_low' -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1 +let s:t_Co = has('gui_running') ? -1 : get(g:, 'solarized_t_Co', get(g:, 't_Co', exists('&t_Co') ? +&t_Co : 0)) let s:italics = (&t_ZH != '' && &t_ZH != '') || has('gui_running') || has('nvim') -let s:t_Co = get(g:, 'solarized_use16', 0) ? 16 : s:t_Co let s:italics = s:italics && get(g:, 'solarized_italics', 1) let s:termtrans = get(g:, 'solarized_termtrans', 0) && !has('gui_running') hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement +hi! link CurSearch Search +hi! link CursorLineFold FoldColumn +hi! link CursorLineSign SignColumn hi! link Debug Special hi! link Define PreProc hi! link Delimiter Special @@ -29,6 +31,8 @@ hi! link Function Identifier hi! link Include PreProc hi! link Keyword Statement hi! link Label Statement +hi! link LineNrAbove LineNr +hi! link LineNrBelow LineNr hi! link Macro PreProc hi! link Number Constant hi! link Operator Statement @@ -44,6 +48,8 @@ hi! link String Constant hi! link Structure Type hi! link Tag Special hi! link Typedef Type +hi! link debugBreakpoint SignColumn +hi! link debugPC SignColumn hi! link lCursor Cursor if &background ==# 'dark' @@ -2410,4 +2416,4 @@ endif " Term Colors: base2 red green yellow blue magenta cyan base02 " Term Colors: base3 orange base1 base0 base00 violet base01 base03 " Background: any -" vim: et ts=2 sw=2 +" vim: et ts=8 sw=2 sts=2 diff --git a/doc/solarized8.txt b/doc/solarized8.txt index ac5d66a..f016e88 100644 --- a/doc/solarized8.txt +++ b/doc/solarized8.txt @@ -1,4 +1,4 @@ -*solarized8.txt* For Vim version 8.2 Last change: 2022 May 03 +*solarized8.txt* For Vim version 9.0 Last change: 2023 Jun 06 Solarized 8 color scheme @@ -53,11 +53,9 @@ terminal. > let g:solarized_termtrans = 0 < - *g:solarized_use16* -Set to 1 if you want to force using the 16 ANSI terminal colors. -> - let g:solarized_use16 = 0 -< + *g:solarized_t_Co* +Set this to tell the colorscheme how many colors are available. + *g:solarized_visibility* Tweak the visibility of a few elements. Allowed values are `"normal"` (default), `"high"`, and `"low"`. diff --git a/templates/_global.colortemplate b/templates/_global.colortemplate index b419472..6079c90 100644 --- a/templates/_global.colortemplate +++ b/templates/_global.colortemplate @@ -1,5 +1,4 @@ ; vim: ft=colortemplate fdm=marker -#let s:t_Co = get(g:, '@optionprefix_use16', 0) ? 16 : s:t_Co #let s:italics = s:italics && get(g:, '@optionprefix_italics', 1) #let s:termtrans = get(g:, '@optionprefix_termtrans', 0) && !has('gui_running') Include: _linked_groups.colortemplate diff --git a/templates/_help.colortemplate b/templates/_help.colortemplate index 2583c69..08975ab 100644 --- a/templates/_help.colortemplate +++ b/templates/_help.colortemplate @@ -54,11 +54,9 @@ terminal. > let g:@optionprefix_termtrans = 0 < - *g:@optionprefix_use16* -Set to 1 if you want to force using the 16 ANSI terminal colors. -> - let g:@optionprefix_use16 = 0 -< + *g:@optionprefix_t_Co* +Set this to tell the colorscheme how many colors are available. + *g:@optionprefix_visibility* Tweak the visibility of a few elements. Allowed values are `"normal"` (default), `"high"`, and `"low"`.