File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44" Similar in spirit to rgb.txt, this plugin establishes a human-friendly name
55" for every color listed in the CSS standard:
66"
7+ " Note: the color names should be in lower case, because Vim will lookup the
8+ " a color by its lower case name.
9+ "
710" https://www.w3.org/TR/css-color-3/
811
912let s: keepcpo= &cpo
@@ -26,7 +29,6 @@ call extend(v:colornames, {
2629 \ ' css_blue' : ' #0000FF' ,
2730 \ ' css_teal' : ' #008080' ,
2831 \ ' css_aqua' : ' #00FFFF' ,
29- \
3032 \ ' css_aliceblue' : ' #f0f8ff' ,
3133 \ ' css_antiquewhite' : ' #faebd7' ,
3234 \ ' css_aquamarine' : ' #7fffd4' ,
@@ -160,6 +162,14 @@ call extend(v:colornames, {
160162 \ ' css_yellowgreen' : ' #9acd32' ,
161163 \ }, ' keep' )
162164
165+ " all keys should be in lower case, convert keys that are not yet
166+ for [key , val] in items (filter (copy (v: colornames ), { key - > key = ~ ' \u' }))
167+ call remove (v: colornames , key )
168+ if ! has_key (v: colornames , tolower (key ))
169+ call extend (v: colornames , {tolower (key ): val}, ' keep' )
170+ endif
171+ endfor
172+
163173let &cpo = s: keepcpo
164174unlet s: keepcpo
165175
Original file line number Diff line number Diff line change 66" time the highlight command fails to recognize a gui color. You can override
77" these colors by introducing a new colors/lists/default.vim file earlier in
88" the runtimepath.
9+ " Note: the color names should be in lower case, because Vim will lookup the
10+ " a color by its lower case name.
911
1012" make sure line continuation works
1113let s: keepcpo = &cpo
@@ -802,6 +804,14 @@ call extend(v:colornames, {
802804 \ ' teal' : ' #008080'
803805 \ }, ' keep' )
804806
807+ " all keys should be in lower case, convert keys that are not yet
808+ for [key , val] in items (filter (copy (v: colornames ), { key - > key = ~ ' \u' }))
809+ call remove (v: colornames , key )
810+ if ! has_key (v: colornames , tolower (key ))
811+ call extend (v: colornames , {tolower (key ): val}, ' keep' )
812+ endif
813+ endfor
814+
805815let &cpo = s: keepcpo
806816unlet s: keepcpo
807817
Original file line number Diff line number Diff line change 1- *eval.txt* For Vim version 9.1. Last change: 2024 Jan 14
1+ *eval.txt* For Vim version 9.1. Last change: 2024 Feb 05
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2005,9 +2005,14 @@ v:collate The current locale setting for collation order of the runtime
20052005 *v:colornames*
20062006v:colornames A dictionary that maps color names to hex color strings. These
20072007 color names can be used with the | highlight-guifg | ,
2008- | highlight-guibg | , and | highlight-guisp | parameters. Updating
2009- an entry in v:colornames has no immediate effect on the syntax
2010- highlighting. The highlight commands (probably in a
2008+ | highlight-guibg | , and | highlight-guisp | parameters.
2009+
2010+ The key values in the dictionary (the color names) should be
2011+ lower cased, because Vim looks up a color by its lower case
2012+ name.
2013+
2014+ Updating an entry in v:colornames has no immediate effect on
2015+ the syntax highlighting. The highlight commands (probably in a
20112016 colorscheme script) need to be re-evaluated in order to use
20122017 the updated color values. For example: >
20132018
Original file line number Diff line number Diff line change 1- *syntax.txt* For Vim version 9.1. Last change: 2024 Jan 24
1+ *syntax.txt* For Vim version 9.1. Last change: 2024 Feb 05
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5265,7 +5265,8 @@ ctermul={color-nr} *highlight-ctermul*
52655265 "cterm=" argument AFTER the "ctermfg=" or "ctermbg=" argument. Or use
52665266 a number instead of a color name.
52675267
5268- The case of the color names is ignored.
5268+ The case of the color names is ignored, however Vim will use lower
5269+ case color names when reading from the | v:colornames | dictionary.
52695270 Note that for 16 color ansi style terminals (including xterms), the
52705271 numbers in the NR-8 column is used. Here '*' means 'add 8' so that
52715272 Blue is 12, DarkGray is 8 etc.
@@ -5384,8 +5385,8 @@ guisp={color-name} *highlight-guisp*
53845385 :highlight Comment guifg=#11f0c3 guibg=#ff00ff
53855386<
53865387 If you are authoring a color scheme and use the same hexadecimal value
5387- repeatedly, you can define a name for it in | v:colornames | . For
5388- example: >
5388+ repeatedly, you can define a (lower case) name for it in | v:colornames | .
5389+ For example: >
53895390
53905391 # provide a default value for this color but allow the user to
53915392 # override it.
You can’t perform that action at this time.
0 commit comments