comparison runtime/doc/usr_06.txt @ 26057:92c424550367 v8.2.3562

patch 8.2.3562: cannot add color names Commit: https://github.com/vim/vim/commit/e30d10253fa634c4f60daa798d029245f4eed393 Author: Drew Vogel <dvogel@github> Date: Sun Oct 24 20:35:07 2021 +0100 patch 8.2.3562: cannot add color names Problem: Cannot add color names. Solution: Add the v:colornames dictionary. (Drew Vogel, closes https://github.com/vim/vim/issues/8761)
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 Oct 2021 21:45:04 +0200
parents af69c9335223
children babd9f1dbe12
comparison
equal deleted inserted replaced
26056:977bbbf36908 26057:92c424550367
182 this command: > 182 this command: >
183 183
184 :runtime syntax/colortest.vim 184 :runtime syntax/colortest.vim
185 185
186 You will see text in various color combinations. You can check which ones are 186 You will see text in various color combinations. You can check which ones are
187 readable and look nice. 187 readable and look nice. These aren't the only colors available to you though.
188 You can specify #rrggbb hex colors and you can define new names for hex
189 colors in |v:colornames| like so: >
190
191 let v:colornames['mine_red'] = '#aa0000'
192 <
193 If you are authoring a color scheme for others to use, it is important
194 to define these colors only when they do not exist: >
195
196 call extend(v:colornames, {'mine_red': '#aa0000'}, 'keep')
197
198 This allows users of the color scheme to override the precise definition of
199 that color prior to loading your color scheme. For example, in a |.vimrc|
200 file:
201
202 runtime colors/lists/css_colors.vim
203 let v:colornames['your_red'] = v:colornames['css_red']
204 colorscheme yourscheme
205
206 As a color scheme author, you should be able to rely on some color names for
207 GUI colors. These are defined in `colors/lists/default.vim`. All such files
208 found on the |runtimepath| are loaded each time the colorscheme command is
209 run. A canonical list is provided by the vim distribution, which should
210 include all X11 colors (previously defined in rgb.txt).
188 211
189 ============================================================================== 212 ==============================================================================
190 *06.4* With colors or without colors 213 *06.4* With colors or without colors
191 214
192 Displaying text in color takes a lot of effort. If you find the displaying 215 Displaying text in color takes a lot of effort. If you find the displaying