@@ -144,8 +144,8 @@ function! s:create_syn_match()
144144 let rgb_color
145145 \ = funcname == ' rgb' ? s: rgb2color (submatch (3 ),submatch (4 ),submatch (5 ))
146146 \ : funcname == ' hsl' ? s: hsl2color (submatch (3 ),submatch (4 ),submatch (5 ))
147- \ : strlen (hex) == 6 ? tolower (hex)
148- \ : strlen (hex) = = 3 ? tolower (hex[0 ].hex[0 ].hex[1 ].hex[1 ].hex[2 ].hex[2 ])
147+ \ : strlen (hex) >= 6 ? tolower (hex[ 0 : 5 ] )
148+ \ : strlen (hex) > = 3 ? tolower (hex[0 ].hex[0 ].hex[1 ].hex[1 ].hex[2 ].hex[2 ])
149149 \ : ' '
150150
151151 if rgb_color == ' ' | throw ' css_color: create_syn_match invoked on bad match data' | endif
@@ -199,13 +199,14 @@ function! s:create_matches()
199199endfunction
200200
201201let s: _hexcolor = ' #\(\x\{3}\%(\>\|\x\{3}\>\)\)' " submatch 1
202+ let s: _rgbacolor = ' #\(\x\{3}\%(\>\|\x\%(\>\|\x\{2}\%(\>\|\x\{2}\>\)\)\)\)' " submatch 1
202203let s: _funcname = ' \(rgb\|hsl\)a\?' " submatch 2
203204let s: _ws_ = ' \s*'
204205let s: _numval = s: _ws_ . ' \(\d\{1,3}%\?\)' " submatch 3,4,5
205206let s: _listsep = s: _ws_ . ' ,'
206207let s: _otherargs_ = ' \%(,[^)]*\)\?'
207208let s: _funcexpr = s: _funcname . ' [(]' . s: _numval . s: _listsep . s: _numval . s: _listsep . s: _numval . s: _ws_ . s: _otherargs_ . ' [)]'
208- let s: _csscolor = s: _hexcolor . ' \|' . s: _funcexpr
209+ let s: _csscolor = s: _rgbacolor . ' \|' . s: _funcexpr
209210" N.B. sloppy heuristic constants for performance reasons:
210211" a) start somewhere left of screen in case of partially visible colorref
211212" b) take some multiple of &columns to handle multibyte chars etc
0 commit comments