README.txt (4614B)
1 README.txt for color scheme files 2 3 These files are used for the `:colorscheme` command. They appear in the 4 "Edit/Color Scheme" menu in the GUI. 5 6 The colorschemes were updated for the Vim 9 release. If you don't like the 7 changes you can find the old ones here: 8 https://github.com/vim/colorschemes/tree/master/legacy_colors 9 10 11 Hints for writing a color scheme file: 12 13 There are two basic ways to define a color scheme: 14 15 1. Define a new Normal color and set the 'background' option accordingly. > 16 17 set background={light or dark} 18 highlight clear 19 highlight Normal ... 20 ... 21 22 2. Use the default Normal color and automatically adjust to the value of 23 'background'. > 24 25 highlight clear Normal 26 set background& 27 highlight clear 28 if &background == "light" 29 highlight Error ... 30 ... 31 else 32 highlight Error ... 33 ... 34 endif 35 36 You can use `:highlight clear` to reset everything to the defaults, and then 37 change the groups that you want differently. This will also work for groups 38 that are added in later versions of Vim. 39 Note that `:highlight clear` uses the value of 'background', thus set it 40 before this command. 41 Some attributes (e.g., bold) might be set in the defaults that you want 42 removed in your color scheme. Use something like "gui=NONE" to remove the 43 attributes. 44 45 In case you want to set 'background' depending on the colorscheme selected, 46 this autocmd might be useful: > 47 48 autocmd SourcePre */colors/blue_sky.vim set background=dark 49 50 Replace "blue_sky" with the name of the colorscheme. 51 52 In case you want to tweak a colorscheme after it was loaded, check out the 53 ColorScheme autocommand event. 54 55 To clean up just before loading another colorscheme, use the ColorSchemePre 56 autocommand event. For example: > 57 58 let g:term_ansi_colors = ... 59 augroup MyColorscheme 60 au! 61 au ColorSchemePre * unlet g:term_ansi_colors 62 au ColorSchemePre * au! MyColorscheme 63 augroup END 64 65 To customize a colorscheme use another name, e.g. "~/.vim/colors/mine.vim", 66 and use ":runtime" to load the original colorscheme: > 67 68 " load the "evening" colorscheme 69 runtime colors/evening.vim 70 " change the color of statements 71 hi Statement ctermfg=Blue guifg=Blue 72 73 To see which highlight group is used where, see `:help highlight-groups` and 74 `:help group-name` . 75 76 You can use ":highlight" to find out the current colors. Exception: the 77 ctermfg and ctermbg values are numbers, which are only valid for the current 78 terminal. Use the color names instead for better portability. See 79 `:help cterm-colors` . 80 81 The default color settings can be found in the source file 82 "src/nvim/highlight_group.c". Search for "highlight_init". 83 84 If you think you have a color scheme that is good enough to be used by others, 85 please check the following items: 86 87 - Does it work in a color terminal as well as in the GUI? Is it consistent? 88 89 - Is "g:colors_name" set to a meaningful value? In case of doubt you can do 90 it this way: > 91 92 let g:colors_name = expand('<sfile>:t:r') 93 94 - Is 'background' either used or appropriately set to "light" or "dark"? 95 96 - Try setting 'hlsearch' and searching for a pattern, is the match easy to 97 spot? 98 99 - Split a window with ":split" and ":vsplit". Are the status lines and 100 vertical separators clearly visible? 101 102 - In the GUI, is it easy to find the cursor, also in a file with lots of 103 syntax highlighting? 104 105 - In general, test your color scheme against as many filetypes, Vim features, 106 environments, etc. as possible. 107 108 - Do not use hard coded escape sequences, these will not work in other 109 terminals. Always use #RRGGBB for the GUI. 110 111 - When targeting 8-16 colors terminals, don't count on "darkblue" to be blue 112 and dark, or on "2" to be even vaguely reddish. Names are more portable 113 than numbers, though. 114 115 - When targeting 256 colors terminals, prefer colors 16-255 to colors 0-15 116 for the same reason. 117 118 - Typographic attributes (bold, italic, underline, reverse, etc.) are not 119 universally supported. Don't count on any of them. 120 121 - Is "g:terminal_ansi_colors" set to a list of 16 #RRGGBB values? 122 123 - Try to keep your color scheme simple by avoiding unnecessary logic and 124 refraining from adding options. The best color scheme is one that only 125 requires: > 126 127 colorscheme foobar 128 129 The color schemes distributed with Vim are built with lifepillar/colortemplate 130 (https://github.com/lifepillar/vim-colortemplate). It is therefore highly 131 recommended. 132 133 If you would like your color scheme to be distributed with Vim, make sure 134 that: 135 136 - it satisfies the guidelines above, 137 - it was made with colortemplate, 138 139 and join us at vim/colorschemes: (https://github.com/vim/colorschemes). 140 141 142 vim: set ft=help :