From e67fa32fd98e3817f82cc049e10d850cd37f8f63 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sat, 10 Aug 2013 13:43:12 +0000 Subject: [PATCH] extract matching background colors for file indicator --- autoload/airline/themes.vim | 9 +++++++-- autoload/airline/themes/badwolf.vim | 2 +- autoload/airline/themes/bubblegum.vim | 2 +- autoload/airline/themes/dark.vim | 8 ++++---- autoload/airline/themes/jellybeans.vim | 8 +++++++- autoload/airline/themes/laederon.vim | 2 +- autoload/airline/themes/light.vim | 2 +- autoload/airline/themes/simple.vim | 2 +- autoload/airline/themes/tomorrow.vim | 3 +++ autoload/airline/themes/ubaryd.vim | 2 +- autoload/airline/themes/wombat.vim | 2 +- 11 files changed, 28 insertions(+), 14 deletions(-) diff --git a/autoload/airline/themes.vim b/autoload/airline/themes.vim index ec3e1697..a1014fdf 100644 --- a/autoload/airline/themes.vim +++ b/autoload/airline/themes.vim @@ -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 diff --git a/autoload/airline/themes/badwolf.vim b/autoload/airline/themes/badwolf.vim index 94b97f81..a7a5fcb0 100644 --- a/autoload/airline/themes/badwolf.vim +++ b/autoload/airline/themes/badwolf.vim @@ -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] , '' ] diff --git a/autoload/airline/themes/bubblegum.vim b/autoload/airline/themes/bubblegum.vim index f6e3d0ce..865edeea 100644 --- a/autoload/airline/themes/bubblegum.vim +++ b/autoload/airline/themes/bubblegum.vim @@ -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] diff --git a/autoload/airline/themes/dark.vim b/autoload/airline/themes/dark.vim index f3f9dd63..079bbd5b 100644 --- a/autoload/airline/themes/dark.vim +++ b/autoload/airline/themes/dark.vim @@ -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 diff --git a/autoload/airline/themes/jellybeans.vim b/autoload/airline/themes/jellybeans.vim index 91e95ef8..792c767e 100644 --- a/autoload/airline/themes/jellybeans.vim +++ b/autoload/airline/themes/jellybeans.vim @@ -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, '', '' ] diff --git a/autoload/airline/themes/laederon.vim b/autoload/airline/themes/laederon.vim index 26ab9574..9c7ddecd 100644 --- a/autoload/airline/themes/laederon.vim +++ b/autoload/airline/themes/laederon.vim @@ -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] , '' ] diff --git a/autoload/airline/themes/light.vim b/autoload/airline/themes/light.vim index cba9186e..4f4786fb 100644 --- a/autoload/airline/themes/light.vim +++ b/autoload/airline/themes/light.vim @@ -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 ] diff --git a/autoload/airline/themes/simple.vim b/autoload/airline/themes/simple.vim index 460665a9..23631c77 100644 --- a/autoload/airline/themes/simple.vim +++ b/autoload/airline/themes/simple.vim @@ -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 ] diff --git a/autoload/airline/themes/tomorrow.vim b/autoload/airline/themes/tomorrow.vim index b1886817..41b90eba 100644 --- a/autoload/airline/themes/tomorrow.vim +++ b/autoload/airline/themes/tomorrow.vim @@ -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') diff --git a/autoload/airline/themes/ubaryd.vim b/autoload/airline/themes/ubaryd.vim index b2e1401e..a0add82c 100644 --- a/autoload/airline/themes/ubaryd.vim +++ b/autoload/airline/themes/ubaryd.vim @@ -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] , '' ] diff --git a/autoload/airline/themes/wombat.vim b/autoload/airline/themes/wombat.vim index 1e0d67a4..623e1c2d 100644 --- a/autoload/airline/themes/wombat.vim +++ b/autoload/airline/themes/wombat.vim @@ -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] , '' ]