refactor ctrlp themes with generate_color_map helper function

This commit is contained in:
Bailey Ling 2013-07-27 20:16:13 +00:00
parent f0982fa310
commit 60cba9cfc4
3 changed files with 29 additions and 28 deletions

View File

@ -1,17 +1,24 @@
function! airline#extensions#ctrlp#generate_color_map(dark, light, white)
return {
\ 'CtrlPdark' : a:dark,
\ 'CtrlPlight' : a:light,
\ 'CtrlPwhite' : a:white,
\ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] ,
\ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] ,
\ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] ,
\ 'CtrlParrow4' : [ a:white[1] , a:dark[1] , a:white[3] , a:dark[3] , '' ] ,
\ 'CtrlParrow5' : [ a:light[1] , a:light[0] , a:light[3] , a:light[2] , '' ] ,
\ }
endfunction
function! airline#extensions#ctrlp#load_theme()
if exists('g:airline#themes#{g:airline_theme}#ctrlp')
let theme = g:airline#themes#{g:airline_theme}#ctrlp
else
let theme = {
\ 'CtrlPdark' : [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ] ,
\ 'CtrlPlight' : [ '#ffffff' , '#875fd7' , 231 , 98 , '' ] ,
\ 'CtrlPwhite' : [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ] ,
\ 'CtrlParrow1' : [ '#875fd7' , '#ffffff' , 98 , 231 , '' ] ,
\ 'CtrlParrow2' : [ '#ffffff' , '#875fd7' , 231 , 98 , '' ] ,
\ 'CtrlParrow3' : [ '#875fd7' , '#5f00af' , 98 , 55 , '' ] ,
\ 'CtrlParrow4' : [ '#ffffff' , '#5f00af' , 231 , 55 , '' ] ,
\ 'CtrlParrow5' : [ '#875fd7' , '#ffffff' , 98 , 231 , '' ] ,
\ }
let theme = airline#extensions#ctrlp#generate_color_map(
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
endif
for key in keys(theme)
call airline#exec_highlight(key, theme[key])

View File

@ -48,12 +48,9 @@ let g:airline#themes#luna#inactive_modified = {
\ 'statusline': [ '#f88379' , '' , '210' , '' , '' ] ,
\ }
let g:airline#themes#luna#ctrlp = {
\ 'CtrlPdark' : [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] ,
\ 'CtrlPlight' : [ '#ffffff' , '#005252' , 231 , 36 , '' ] ,
\ 'CtrlPwhite' : [ '#ffffff' , '#973d45' , 231 , 95 , '' ] ,
\ 'CtrlParrow1' : [ '#005252' , '#973d45' , 36 , 95 , '' ] ,
\ 'CtrlParrow2' : [ '#973d45' , '#005252' , 95 , 36 , '' ] ,
\ 'CtrlParrow3' : [ '#005252' , '#002b2b' , 36 , 23 , '' ] ,
\ 'CtrlParrow4' : [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] ,
\ 'CtrlParrow5' : [ '#005252' , '#003f3f' , 36 , 29 , '' ] }
if get(g:, 'loaded_ctrlp', 0)
let g:airline#themes#luna#ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] ,
\ [ '#ffffff' , '#005252' , 231 , 36 , '' ] ,
\ [ '#ffffff' , '#973d45' , 231 , 95 , '' ] )
endif

View File

@ -88,12 +88,9 @@ let g:airline#themes#wombat#inactive_modified = {
\ 'statusline' : [ '#BCBCBC' , '' , 250 , '' , '' ] }
let g:airline#themes#wombat#ctrlp = {
\ 'CtrlPdark' : [ '#DADADA' , '#242424' , 253 , 234 , '' ] ,
\ 'CtrlPlight' : [ '#DADADA' , '#40403C' , 253 , 238 , '' ] ,
\ 'CtrlPwhite' : [ '#141413' , '#DADADA' , 232 , 253 , 'bold' ] ,
\ 'CtrlParrow1' : [ '#40403C' , '#DADADA' , 238 , 253 , '' ] ,
\ 'CtrlParrow2' : [ '#DADADA' , '#40403C' , 253 , 238 , '' ] ,
\ 'CtrlParrow3' : [ '#40403C' , '#242424' , 238 , 234 , '' ] ,
\ 'CtrlParrow4' : [ '#DADADA' , '#242424' , 253 , 234 , '' ] ,
\ 'CtrlParrow5' : [ '#40403C' , '#DADADA' , 238 , 253 , '' ] }
if get(g:, 'loaded_ctrlp', 0)
let g:airline#themes#wombat#ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#DADADA' , '#242424' , 253 , 234 , '' ] ,
\ [ '#DADADA' , '#40403C' , 253 , 238 , '' ] ,
\ [ '#141413' , '#DADADA' , 232 , 253 , 'bold' ] )
endif