extract matching background colors for file indicator

This commit is contained in:
Bailey Ling 2013-08-10 13:43:12 +00:00
parent 1d46c5874b
commit e67fa32fd9
11 changed files with 28 additions and 14 deletions

View File

@ -3,14 +3,19 @@
" generates a dictionary which defines the colors for each highlight group
function! airline#themes#generate_color_map(section1, section2, section3, file)
" provide matching background colors if not provided
let file = copy(a:file)
if file[1] == '' | let file[1] = a:section3[1] | endif
if file[3] == '' | let file[3] = a:section3[3] | endif
" guifg guibg ctermfg ctermbg gui/term
return {
\ 'mode': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1, 4, 'bold') ] ,
\ 'mode_separator': [ a:section1[1] , a:section2[1] , a:section1[3] , a:section2[3] , '' ] ,
\ 'info': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2, 4, '' ) ] ,
\ 'info_separator': [ a:section2[1] , a:section3[1] , a:section2[3] , a:section3[3] , '' ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3, 4, '' ) ] ,
\ 'file': [ a:file[0] , a:file[1] , a:file[2] , a:file[3] , get(a:file , 4, '' ) ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] ,
\ 'file': [ file[0] , file[1] , file[2] , file[3] , get(file , 4 , '' ) ] ,
\ }
endfunction

View File

@ -15,7 +15,7 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
let s:RE = [ '#ff9eb8' , 211 ] " dress
let s:file = [ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff2c4b' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]

View File

@ -20,7 +20,7 @@ let s:cterm_red = 174
let s:gui_pink = '#d7afd7'
let s:cterm_pink = 182
let s:file = ['#ff0000', '#1c1c1c', 160, 233, '']
let s:file = ['#ff0000', '', 160, '', '']
" Normal mode
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green]

View File

@ -23,10 +23,10 @@
"
" The array is in the format [ guifg, guibg, ctermfg, ctermbg, opts ].
" The opts takes in values from ":help attr-list".
let s:file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let s:file = [ '#ff0000' , '' , 160 , '' , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
" vim-airline is made up of multiple sections, but for theming purposes there
" is only 3 sections: the mode, the branch indicator, and the gutter (which

View File

@ -6,10 +6,16 @@ function! s:generate()
" Here are examples where the entire highlight group is copied and an airline
" compatible color array is generated.
let s:file = airline#themes#get_highlight('Constant')
let s:N1 = airline#themes#get_highlight('DbgCurrent', 'bold')
let s:N2 = airline#themes#get_highlight('Folded')
let s:N3 = airline#themes#get_highlight('NonText')
" The file indicator is a special case where if the background values are
" empty the generate_color_map function will extract a matching color.
let s:file = airline#themes#get_highlight('Constant')
let s:file[1] = ''
let s:file[3] = ''
let g:airline#themes#jellybeans#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#jellybeans#normal_modified = {
\ 'statusline': [ '#ffb964', '', 215, '', '' ]

View File

@ -24,7 +24,7 @@ let s:RE = [ '#233e09' , 22 ] " oakleaf
" Paste mode
let s:PA = [ '#ab3e5d' , 161 ] " raspberry
let s:file = [ '#ef393d' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ef393d' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]

View File

@ -1,4 +1,4 @@
let s:file = [ '#df0000' , '#ffffff' , 160 , 255 ]
let s:file = [ '#df0000' , '' , 160 , '' ]
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ]
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ]

View File

@ -36,7 +36,7 @@ let s:termbg = 232
let s:termsep = 236
let s:guisep = '#303030'
let s:file = [ '#ff0000' , s:guibg , 160 , s:termbg , '' ]
let s:file = [ '#ff0000' , '' , 160 , '' , '' ]
let s:N1 = s:swap ? [ s:guibg , '#00dfff' , s:termbg , 45 ] : [ '#00dfff' , s:guibg , 45 , s:termbg ]
let s:N2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ]
let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg ]

View File

@ -1,5 +1,8 @@
function! s:generate()
let s:file = airline#themes#get_highlight('Constant')
" clear out backgrounds so generate_color_map will fill them in
let s:file[1] = ''
let s:file[3] = ''
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold')
let s:N2 = airline#themes#get_highlight('Pmenu')

View File

@ -24,7 +24,7 @@ let s:RE = [ '#c7915b' , 173 ] " nut
" Paste mode
let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon
let s:file = [ '#ff7400' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff7400' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]

View File

@ -33,7 +33,7 @@ let s:PA = [ '#94E42C' , 47 ]
let s:IM = [ '#40403C' , 238 ]
" File permissions (RO, etc)
let s:file = [ '#E5786D' , s:N3[1] , 203 , s:N3[3] , '' ]
let s:file = [ '#E5786D' , '' , 203 , '' , '' ]
" Inactive mode
let s:IA = [ '#767676' , s:N3[1] , 243 , s:N3[3] , '' ]