make easier to theme

This commit is contained in:
Bailey Ling 2013-07-01 00:11:37 +02:00
parent 695899636d
commit fda2171dee
3 changed files with 37 additions and 26 deletions

View File

@ -25,7 +25,7 @@ there are a couple configuration values available:
* `g:airline_right_sep` the seperator used on the right side * `g:airline_right_sep` the seperator used on the right side
* `g:airline_enable_fugitive` enable/disable fugitive integration * `g:airline_enable_fugitive` enable/disable fugitive integration
* `g:airline_enable_syntastic` enable/disable syntastic integration * `g:airline_enable_syntastic` enable/disable syntastic integration
* `g:airline_theme' change the theme, currently only `default` is available * `g:airline_theme` change the theme, currently only `default` is available
* `g:airline_powerline_fonts` enable/disable usage of patched powerline font symbols * `g:airline_powerline_fonts` enable/disable usage of patched powerline font symbols
# contributions # contributions

View File

@ -1,26 +1,26 @@
let g:airline#themes#default#normal = { let g:airline#themes#default#normal = {
\ 'mode': [ 'User2' , '#00005f' , '#dfff00' , 17 , 190 , 'bold' ] , \ 'mode': [ '#00005f' , '#dfff00' , 17 , 190 , 'bold' ] ,
\ 'mode_seperator': [ 'User3' , '#dfff00' , '#444444' , 190 , 238 , 'bold' ] , \ 'mode_seperator': [ '#dfff00' , '#444444' , 190 , 238 , 'bold' ] ,
\ 'info': [ 'User4' , '#ffffff' , '#444444' , 255 , 238 , '' ] , \ 'info': [ '#ffffff' , '#444444' , 255 , 238 , '' ] ,
\ 'info_seperator': [ 'User5' , '#444444' , '#202020' , 238 , 234 , 'bold' ] , \ 'info_seperator': [ '#444444' , '#202020' , 238 , 234 , 'bold' ] ,
\ 'statusline': [ 'StatusLine' , '#9cffd3' , '#202020' , 85 , 234 , '' ] , \ 'statusline': [ '#9cffd3' , '#202020' , 85 , 234 , '' ] ,
\ 'statusline_nc': [ 'StatusLineNC' , '#000000' , '#202020' , 232 , 234 , '' ] , \ 'statusline_nc': [ '#000000' , '#202020' , 232 , 234 , '' ] ,
\ 'file': [ 'User6' , '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] , \ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] ,
\ 'inactive': [ 'User9' , '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] , \ 'inactive': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] ,
\ } \ }
let g:airline#themes#default#insert = { let g:airline#themes#default#insert = {
\ 'mode': [ 'User2' , '#00005f' , '#00dfff' , 17 , 45 , 'bold' ] , \ 'mode': [ '#00005f' , '#00dfff' , 17 , 45 , 'bold' ] ,
\ 'mode_seperator': [ 'User3' , '#00dfff' , '#005fff' , 45 , 27 , 'bold' ] , \ 'mode_seperator': [ '#00dfff' , '#005fff' , 45 , 27 , 'bold' ] ,
\ 'info': [ 'User4' , '#ffffff' , '#005fff' , 255 , 27 , '' ] , \ 'info': [ '#ffffff' , '#005fff' , 255 , 27 , '' ] ,
\ 'info_seperator': [ 'User5' , '#005fff' , '#000087' , 27 , 18 , 'bold' ] , \ 'info_seperator': [ '#005fff' , '#000087' , 27 , 18 , 'bold' ] ,
\ 'statusline': [ 'StatusLine' , '#ffffff' , '#000080' , 15 , 17 , '' ] , \ 'statusline': [ '#ffffff' , '#000080' , 15 , 17 , '' ] ,
\ } \ }
let g:airline#themes#default#visual = { let g:airline#themes#default#visual = {
\ 'mode': [ 'User2' , '#000000' , '#ffaf00' , 232 , 214 , 'bold' ] , \ 'mode': [ '#000000' , '#ffaf00' , 232 , 214 , 'bold' ] ,
\ 'mode_seperator': [ 'User3' , '#ffaf00' , '#ff5f00' , 214 , 202 , 'bold' ] , \ 'mode_seperator': [ '#ffaf00' , '#ff5f00' , 214 , 202 , 'bold' ] ,
\ 'info': [ 'User4' , '#000000' , '#ff5f00' , 232 , 202 , '' ] , \ 'info': [ '#000000' , '#ff5f00' , 232 , 202 , '' ] ,
\ 'info_seperator': [ 'User5' , '#000000' , '#5f0000' , 202 , 52 , 'bold' ] , \ 'info_seperator': [ '#000000' , '#5f0000' , 202 , 52 , 'bold' ] ,
\ 'statusline': [ 'StatusLine' , '#ffffff' , '#5f0000' , 15 , 52 , '' ] , \ 'statusline': [ '#ffffff' , '#5f0000' , 15 , 52 , '' ] ,
\ } \ }

View File

@ -23,16 +23,27 @@ let s:airline_colors_normal = g:airline#themes#{g:airline_theme}#normal
let s:airline_colors_insert = g:airline#themes#{g:airline_theme}#insert let s:airline_colors_insert = g:airline#themes#{g:airline_theme}#insert
let s:airline_colors_visual = g:airline#themes#{g:airline_theme}#visual let s:airline_colors_visual = g:airline#themes#{g:airline_theme}#visual
let s:airline_highlight_map = {
\ 'mode' : 'User2',
\ 'mode_seperator' : 'User3',
\ 'info' : 'User4',
\ 'info_seperator' : 'User5',
\ 'statusline' : 'StatusLine',
\ 'statusline_nc' : 'StatusLineNC',
\ 'file' : 'User6',
\ 'inactive' : 'User9',
\ }
function! s:highlight(mode, key) function! s:highlight(mode, key)
let colors = s:airline_colors_{a:mode}[a:key] let colors = s:airline_colors_{a:mode}[a:key]
let cmd = printf('hi %s %s %s %s %s %s %s', let cmd = printf('hi %s %s %s %s %s %s %s',
\ colors[0], \ s:airline_highlight_map[a:key],
\ colors[1] != '' ? 'guifg='.colors[1] : '', \ colors[0] != '' ? 'guifg='.colors[0] : '',
\ colors[2] != '' ? 'guibg='.colors[2] : '', \ colors[1] != '' ? 'guibg='.colors[1] : '',
\ colors[3] != '' ? 'ctermfg='.colors[3] : '', \ colors[2] != '' ? 'ctermfg='.colors[2] : '',
\ colors[4] != '' ? 'ctermbg='.colors[4] : '', \ colors[3] != '' ? 'ctermbg='.colors[3] : '',
\ colors[5] != '' ? 'gui='.colors[5] : '', \ colors[4] != '' ? 'gui='.colors[4] : '',
\ colors[5] != '' ? 'term='.colors[5] : '') \ colors[4] != '' ? 'term='.colors[4] : '')
exec cmd exec cmd
endfunction endfunction