README.txt 4.6 KB

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