@@ -144,8 +144,8 @@ function! s:create_syn_match()
144
144
let rgb_color
145
145
\ = funcname == ' rgb' ? s: rgb2color (submatch (3 ),submatch (4 ),submatch (5 ))
146
146
\ : 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 ])
149
149
\ : ' '
150
150
151
151
if rgb_color == ' ' | throw ' css_color: create_syn_match invoked on bad match data' | endif
@@ -199,13 +199,14 @@ function! s:create_matches()
199
199
endfunction
200
200
201
201
let s: _hexcolor = ' #\(\x\{3}\%(\>\|\x\{3}\>\)\)' " submatch 1
202
+ let s: _rgbacolor = ' #\(\x\{3}\%(\>\|\x\%(\>\|\x\{2}\%(\>\|\x\{2}\>\)\)\)\)' " submatch 1
202
203
let s: _funcname = ' \(rgb\|hsl\)a\?' " submatch 2
203
204
let s: _ws_ = ' \s*'
204
205
let s: _numval = s: _ws_ . ' \(\d\{1,3}%\?\)' " submatch 3,4,5
205
206
let s: _listsep = s: _ws_ . ' ,'
206
207
let s: _otherargs_ = ' \%(,[^)]*\)\?'
207
208
let 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
209
210
" N.B. sloppy heuristic constants for performance reasons:
210
211
" a) start somewhere left of screen in case of partially visible colorref
211
212
" b) take some multiple of &columns to handle multibyte chars etc
0 commit comments