themes: prepare for vim9script implementation

This commit is contained in:
Christian 2020-11-18 19:10:56 +01:00 committed by Christian Brabandt
parent f08b7912c6
commit 0a80997100
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -3,8 +3,10 @@
scriptencoding utf-8 scriptencoding utf-8
" generates a dictionary which defines the colors for each highlight group unlet! g:airline_experimental
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
" generates a dictionary which defines the colors for each highlight group
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
let palette = { let palette = {
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] , \ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] , \ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
@ -26,17 +28,17 @@ function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
endif endif
return palette return palette
endfunction endfunction
function! airline#themes#get_highlight(group, ...) function! airline#themes#get_highlight(group, ...)
return call('airline#highlighter#get_highlight', [a:group] + a:000) return call('airline#highlighter#get_highlight', [a:group] + a:000)
endfunction endfunction
function! airline#themes#get_highlight2(fg, bg, ...) function! airline#themes#get_highlight2(fg, bg, ...)
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000) return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
endfunction endfunction
function! airline#themes#patch(palette) function! airline#themes#patch(palette)
for mode in keys(a:palette) for mode in keys(a:palette)
if mode == 'accents' if mode == 'accents'
continue continue
@ -75,4 +77,7 @@ function! airline#themes#patch(palette)
if !has_key(a:palette.accents, 'purple') if !has_key(a:palette.accents, 'purple')
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
endif endif
endfunction endfunction
else
" New Vim9script implementation
endif