diff options
author | Drew Vogel <dvogel@github> | 2021-10-24 20:35:07 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-24 20:35:07 +0100 |
commit | e30d10253fa634c4f60daa798d029245f4eed393 (patch) | |
tree | 57aca74b65dc4c3924ef23185b8cb2b6933996c2 /runtime/doc/usr_06.txt | |
parent | 3c5904d2a5d7861c227a4c3cd4ddcbc51014c838 (diff) | |
download | vim-git-e30d10253fa634c4f60daa798d029245f4eed393.tar.gz |
patch 8.2.3562: cannot add color namesv8.2.3562
Problem: Cannot add color names.
Solution: Add the v:colornames dictionary. (Drew Vogel, closes #8761)
Diffstat (limited to 'runtime/doc/usr_06.txt')
-rw-r--r-- | runtime/doc/usr_06.txt | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt index 65d69dec5..2cf672e70 100644 --- a/runtime/doc/usr_06.txt +++ b/runtime/doc/usr_06.txt @@ -184,7 +184,30 @@ this command: > :runtime syntax/colortest.vim You will see text in various color combinations. You can check which ones are -readable and look nice. +readable and look nice. These aren't the only colors available to you though. +You can specify #rrggbb hex colors and you can define new names for hex +colors in |v:colornames| like so: > + + let v:colornames['mine_red'] = '#aa0000' +< +If you are authoring a color scheme for others to use, it is important +to define these colors only when they do not exist: > + + call extend(v:colornames, {'mine_red': '#aa0000'}, 'keep') + +This allows users of the color scheme to override the precise definition of +that color prior to loading your color scheme. For example, in a |.vimrc| +file: + + runtime colors/lists/css_colors.vim + let v:colornames['your_red'] = v:colornames['css_red'] + colorscheme yourscheme + +As a color scheme author, you should be able to rely on some color names for +GUI colors. These are defined in `colors/lists/default.vim`. All such files +found on the |runtimepath| are loaded each time the colorscheme command is +run. A canonical list is provided by the vim distribution, which should +include all X11 colors (previously defined in rgb.txt). ============================================================================== *06.4* With colors or without colors |