README.txt (4692B)
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 src/syntax.c. 82 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 - Source the $VIMRUNTIME/colors/tools/check_colors.vim script to check for 88 common mistakes. 89 90 - Does it work in a color terminal as well as in the GUI? Is it consistent? 91 92 - Is "g:colors_name" set to a meaningful value? In case of doubt you can do 93 it this way: > 94 95 let g:colors_name = expand('<sfile>:t:r') 96 97 - Is 'background' either used or appropriately set to "light" or "dark"? 98 99 - Try setting 'hlsearch' and searching for a pattern, is the match easy to 100 spot? 101 102 - Split a window with ":split" and ":vsplit". Are the status lines and 103 vertical separators clearly visible? 104 105 - In the GUI, is it easy to find the cursor, also in a file with lots of 106 syntax highlighting? 107 108 - In general, test your color scheme against as many filetypes, Vim features, 109 environments, etc. as possible. 110 111 - Do not use hard coded escape sequences, these will not work in other 112 terminals. Always use #RRGGBB for the GUI. 113 114 - When targeting 8-16 colors terminals, don't count on "darkblue" to be blue 115 and dark, or on "2" to be even vaguely reddish. Names are more portable 116 than numbers, though. 117 118 - When targeting 256 colors terminals, prefer colors 16-255 to colors 0-15 119 for the same reason. 120 121 - Typographic attributes (bold, italic, underline, reverse, etc.) are not 122 universally supported. Don't count on any of them. 123 124 - Is "g:terminal_ansi_colors" set to a list of 16 #RRGGBB values? 125 126 - Try to keep your color scheme simple by avoiding unnecessary logic and 127 refraining from adding options. The best color scheme is one that only 128 requires: > 129 130 colorscheme foobar 131 132 The color schemes distributed with Vim are built with lifepillar/colortemplate 133 (https://github.com/lifepillar/vim-colortemplate). It is therefore highly 134 recommended. 135 136 If you would like your color scheme to be distributed with Vim, make sure 137 that: 138 139 - it satisfies the guidelines above, 140 - it was made with colortemplate, 141 142 and join us at vim/colorschemes: (https://github.com/vim/colorschemes). 143 144 145 vim: set ft=help :