patch 8.2.3562: cannot add color names
Problem: Cannot add color names. Solution: Add the v:colornames dictionary. (Drew Vogel, closes #8761)
This commit is contained in:
committed by
Bram Moolenaar
parent
3c5904d2a5
commit
e30d10253f
@ -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
|
||||
|
||||
Reference in New Issue
Block a user