README.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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
  61. "src/nvim/highlight_group.c". 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. - Does it work in a color terminal as well as in the GUI? Is it consistent?
  65. - Is "g:colors_name" set to a meaningful value? In case of doubt you can do
  66. it this way: >
  67. let g:colors_name = expand('<sfile>:t:r')
  68. - Is 'background' either used or appropriately set to "light" or "dark"?
  69. - Try setting 'hlsearch' and searching for a pattern, is the match easy to
  70. spot?
  71. - Split a window with ":split" and ":vsplit". Are the status lines and
  72. vertical separators clearly visible?
  73. - In the GUI, is it easy to find the cursor, also in a file with lots of
  74. syntax highlighting?
  75. - In general, test your color scheme against as many filetypes, Vim features,
  76. environments, etc. as possible.
  77. - Do not use hard coded escape sequences, these will not work in other
  78. terminals. Always use #RRGGBB for the GUI.
  79. - When targeting 8-16 colors terminals, don't count on "darkblue" to be blue
  80. and dark, or on "2" to be even vaguely reddish. Names are more portable
  81. than numbers, though.
  82. - When targeting 256 colors terminals, prefer colors 16-255 to colors 0-15
  83. for the same reason.
  84. - Typographic attributes (bold, italic, underline, reverse, etc.) are not
  85. universally supported. Don't count on any of them.
  86. - Is "g:terminal_ansi_colors" set to a list of 16 #RRGGBB values?
  87. - Try to keep your color scheme simple by avoiding unnecessary logic and
  88. refraining from adding options. The best color scheme is one that only
  89. requires: >
  90. colorscheme foobar
  91. The color schemes distributed with Vim are built with lifepillar/colortemplate
  92. (https://github.com/lifepillar/vim-colortemplate). It is therefore highly
  93. recommended.
  94. If you would like your color scheme to be distributed with Vim, make sure
  95. that:
  96. - it satisfies the guidelines above,
  97. - it was made with colortemplate,
  98. and join us at vim/colorschemes: (https://github.com/vim/colorschemes).
  99. vim: set ft=help :