colortest.vim (3267B)
1 " Vim script for testing colors 2 " Maintainer: The Vim Project <https://github.com/vim/vim> 3 " Contributors: Rafael Garcia-Suarez, Charles Campbell 4 " Last Change: 2023 Aug 10 5 " Former Maintainer: Bram Moolenaar <Bram@vim.org> 6 7 " edit this file, then do ":source %", and check if the colors match 8 9 " black black_on_white white_on_black 10 " black_on_black black_on_black 11 " darkred darkred_on_white white_on_darkred 12 " darkred_on_black black_on_darkred 13 " darkgreen darkgreen_on_white white_on_darkgreen 14 " darkgreen_on_black black_on_darkgreen 15 " brown brown_on_white white_on_brown 16 " brown_on_black black_on_brown 17 " darkblue darkblue_on_white white_on_darkblue 18 " darkblue_on_black black_on_darkblue 19 " darkmagenta darkmagenta_on_white white_on_darkmagenta 20 " darkmagenta_on_black black_on_darkmagenta 21 " darkcyan darkcyan_on_white white_on_darkcyan 22 " darkcyan_on_black black_on_darkcyan 23 " lightgray lightgray_on_white white_on_lightgray 24 " lightgray_on_black black_on_lightgray 25 " darkgray darkgray_on_white white_on_darkgray 26 " darkgray_on_black black_on_darkgray 27 " red red_on_white white_on_red 28 " red_on_black black_on_red 29 " green green_on_white white_on_green 30 " green_on_black black_on_green 31 " yellow yellow_on_white white_on_yellow 32 " yellow_on_black black_on_yellow 33 " blue blue_on_white white_on_blue 34 " blue_on_black black_on_blue 35 " magenta magenta_on_white white_on_magenta 36 " magenta_on_black black_on_magenta 37 " cyan cyan_on_white white_on_cyan 38 " cyan_on_black black_on_cyan 39 " white white_on_white white_on_white 40 " white_on_black black_on_white 41 " grey grey_on_white white_on_grey 42 " grey_on_black black_on_grey 43 " lightred lightred_on_white white_on_lightred 44 " lightred_on_black black_on_lightred 45 " lightgreen lightgreen_on_white white_on_lightgreen 46 " lightgreen_on_black black_on_lightgreen 47 " lightyellow lightyellow_on_white white_on_lightyellow 48 " lightyellow_on_black black_on_lightyellow 49 " lightblue lightblue_on_white white_on_lightblue 50 " lightblue_on_black black_on_lightblue 51 " lightmagenta lightmagenta_on_white white_on_lightmagenta 52 " lightmagenta_on_black black_on_lightmagenta 53 " lightcyan lightcyan_on_white white_on_lightcyan 54 " lightcyan_on_black black_on_lightcyan 55 56 " Open this file in a window if it isn't edited yet. 57 " Use the current window if it's empty. 58 if expand('%:p') != expand('<sfile>:p') 59 let s:fname = expand('<sfile>') 60 if exists('*fnameescape') 61 let s:fname = fnameescape(s:fname) 62 else 63 let s:fname = escape(s:fname, ' \|') 64 endif 65 if &mod || line('$') != 1 || getline(1) != '' 66 exe "new " . s:fname 67 else 68 exe "edit " . s:fname 69 endif 70 unlet s:fname 71 endif 72 73 syn clear 74 8 75 while search("_on_", "W") < 55 76 let col1 = substitute(expand("<cword>"), '\(\a\+\)_on_\a\+', '\1', "") 77 let col2 = substitute(expand("<cword>"), '\a\+_on_\(\a\+\)', '\1', "") 78 exec 'hi col_'.col1.'_'.col2.' ctermfg='.col1.' guifg='.col1.' ctermbg='.col2.' guibg='.col2 79 exec 'syn keyword col_'.col1.'_'.col2.' '.col1.'_on_'.col2 80 endwhile 81 8,54g/^" \a/exec 'hi col_'.expand("<cword>").' ctermfg='.expand("<cword>").' guifg='.expand("<cword>")| exec 'syn keyword col_'.expand("<cword>")." ".expand("<cword>") 82 nohlsearch