diff --git a/autoload/colorizer.vim b/autoload/colorizer.vim index b33ea5a..020eb3c 100644 --- a/autoload/colorizer.vim +++ b/autoload/colorizer.vim @@ -99,7 +99,7 @@ function! s:SetMatcher(color, pat) "{{{1 endif endfunction -"i Color Converters {{{1 +" Color Converters {{{1 function! s:RgbBgColor() "{{{2 let bg = synIDattr(synIDtrans(hlID("Normal")), "bg") let r = str2nr(bg[1:2], 16) @@ -192,8 +192,13 @@ function! s:HexCode(str, lineno) "{{{2 let ha = tolower(foundcolor[7:8]) endif if len(foundcolor) == 9 - let alpha = foundcolor[7:8] - let foundcolor = foundcolor[0:6] + if get(g:, 'colorizer_hex_alpha_first') == 1 + let alpha = foundcolor[1:2] + let foundcolor = '#'.foundcolor[3:8] + else + let alpha = foundcolor[7:8] + let foundcolor = foundcolor[0:6] + endif else let alpha = 'ff' endif diff --git a/plugin/colorizer.vim b/plugin/colorizer.vim index 850913e..c32e5cb 100644 --- a/plugin/colorizer.vim +++ b/plugin/colorizer.vim @@ -33,6 +33,10 @@ " let g:colorizer_maxlines = 1000 " -1 means unlimited number of lines " +" There are color strings in the format #RRGGBBAA and #AARRGGBB. The former is +" more common so it's the default. If you want the latter, set the following: +" let g:colorizer_hex_alpha_first = 1 +" " Note: if you modify a color string in normal mode, if the cursor is still on " that line, it'll take 'updatetime' seconds to update. You can use " :ColorHighlight (or your key mapping) again to force update.