1README.txt for color scheme files 2 3These files are used for the ":colorscheme" command. They appear in the 4Edit/Color Scheme menu in the GUI. 5 6 7Hints for writing a color scheme file: 8 9There are two basic ways to define a color scheme: 10 111. Define a new Normal color and set the 'background' option accordingly. 12 set background={light or dark} 13 highlight clear 14 highlight Normal ... 15 ... 16 172. Use the default Normal color and automatically adjust to the value of 18 'background'. 19 highlight clear Normal 20 set background& 21 highlight clear 22 if &background == "light" 23 highlight Error ... 24 ... 25 else 26 highlight Error ... 27 ... 28 endif 29 30You can use ":highlight clear" to reset everything to the defaults, and then 31change the groups that you want differently. This also will work for groups 32that are added in later versions of Vim. 33Note that ":highlight clear" uses the value of 'background', thus set it 34before this command. 35Some attributes (e.g., bold) might be set in the defaults that you want 36removed in your color scheme. Use something like "gui=NONE" to remove the 37attributes. 38 39In case you want to set 'background' depending on the colorscheme selected, 40this autocmd might be useful: 41 autocmd SourcePre */colors/blue_sky.vim set background=dark 42Replace "blue_sky" with the name of the colorscheme. 43 44In case you want to tweak a colorscheme after it was loaded, check out the 45ColorScheme autocommand event. 46 47To clean up just before loading another colorscheme, use the ColorSchemePre 48autocommand event. For example: 49 let g:term_ansi_colors = ... 50 augroup MyColorscheme 51 au! 52 au ColorSchemePre * unlet g:term_ansi_colors 53 au ColorSchemePre * au! MyColorscheme 54 augroup END 55 56To customize a colorscheme use another name, e.g. "~/.vim/colors/mine.vim", 57and use `:runtime` to load the original colorscheme: 58 " load the "evening" colorscheme 59 runtime colors/evening.vim 60 " change the color of statements 61 hi Statement ctermfg=Blue guifg=Blue 62 63To see which highlight group is used where, find the help for 64"highlight-groups" and "group-name". 65 66You can use ":highlight" to find out the current colors. Exception: the 67ctermfg and ctermbg values are numbers, which are only valid for the current 68terminal. Use the color names instead. See ":help cterm-colors". 69 70The default color settings can be found in the source file src/highlight.c. 71Search for "highlight_init". 72 73If you think you have a color scheme that is good enough to be used by others, 74please check the following items: 75 76- Source the $VIMRUNTIME/colors/tools/check_colors.vim script to check for 77 common mistakes. 78- Does it work in a color terminal as well as in the GUI? 79- Is "g:colors_name" set to a meaningful value? In case of doubt you can do 80 it this way: 81 let g:colors_name = expand('<sfile>:t:r') 82- Is 'background' either used or appropriately set to "light" or "dark"? 83- Try setting 'hlsearch' and searching for a pattern, is the match easy to 84 spot? 85- Split a window with ":split" and ":vsplit". Are the status lines and 86 vertical separators clearly visible? 87- In the GUI, is it easy to find the cursor, also in a file with lots of 88 syntax highlighting? 89- Do not use hard coded escape sequences, these will not work in other 90 terminals. Always use color names or #RRGGBB for the GUI. See v:colornames 91 for details on how to define your own color names. 92