extract colors from normal if undefined (#67, #113).

This commit is contained in:
Bailey Ling 2013-08-04 19:10:44 +00:00
parent 2bedd8ef84
commit a5fe4d9972
4 changed files with 16 additions and 6 deletions

View File

@ -11,7 +11,7 @@ Lean & mean statusline for vim that's light as air.
* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. * looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* optimized for speed; it loads in under a millisecond. * optimized for speed; it loads in under a millisecond.
* fully customizable; if you know a little `statusline` syntax you can tweak it to your needs. * fully customizable; if you know a little `statusline` syntax you can tweak it to your needs.
* trivial to write colorschemes; for a minimal theme you need to edit 9 lines of colors (please send pull requests). * trivial to write colorschemes; over 10 themes have been contributed.
* supports 7.2 as the minimum Vim version * supports 7.2 as the minimum Vim version
# Rationale # Rationale

View File

@ -19,9 +19,17 @@ function! s:get_syn(group, what)
endfunction endfunction
function! s:get_array(fg, bg, opts) function! s:get_array(fg, bg, opts)
let fg = a:fg
let bg = a:bg
if fg == '' || fg < 0
let fg = s:get_syn('Normal', 'fg')
endif
if bg == '' || bg < 0
let bg = s:get_syn('Normal', 'bg')
endif
return has('gui_running') return has('gui_running')
\ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ] \ ? [ fg, bg, '', '', join(a:opts, ',') ]
\ : [ '', '', a:fg >= 0 ? a:fg : '', a:bg >= 0 ? a:bg : '', join(a:opts, ',') ] \ : [ '', '', fg, bg, join(a:opts, ',') ]
endfunction endfunction
function! airline#themes#get_highlight(group, ...) function! airline#themes#get_highlight(group, ...)

View File

@ -2,7 +2,7 @@ function! s:generate()
let s:file = airline#themes#get_highlight('Constant') let s:file = airline#themes#get_highlight('Constant')
let s:N1 = airline#themes#get_highlight('DiffDelete', 'bold') let s:N1 = airline#themes#get_highlight('DiffDelete', 'bold')
let s:N2 = airline#themes#get_highlight('Pmenu') let s:N2 = airline#themes#get_highlight('Pmenu')
let s:N3 = airline#themes#get_highlight('NonText') let s:N3 = airline#themes#get_highlight('CursorLine')
let g:airline#themes#tomorrow#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) let g:airline#themes#tomorrow#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#tomorrow#normal_modified = { let g:airline#themes#tomorrow#normal_modified = {
\ 'statusline': airline#themes#get_highlight('vimCommand') \ 'statusline': airline#themes#get_highlight('vimCommand')
@ -26,7 +26,7 @@ function! s:generate()
let g:airline#themes#tomorrow#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) let g:airline#themes#tomorrow#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#tomorrow#visual_modified = g:airline#themes#tomorrow#normal_modified let g:airline#themes#tomorrow#visual_modified = g:airline#themes#tomorrow#normal_modified
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['Normal', 'bg']) let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg'])
let g:airline#themes#tomorrow#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) let g:airline#themes#tomorrow#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
endfunction endfunction

View File

@ -13,7 +13,7 @@ FEATURES *airline-features*
* integrates with many popular plugins. * integrates with many popular plugins.
* looks good with regular fonts, and provides configuration points so you * looks good with regular fonts, and provides configuration points so you
can use unicode or powerline symbols. can use unicode or powerline symbols.
* optimized for speed; it loads in 1ms. * optimized for speed; it loads in under a millisecond.
* fully customizable; if you know a little |statusline| syntax you can * fully customizable; if you know a little |statusline| syntax you can
tweak it to your needs. tweak it to your needs.
* trivial to write colorschemes; for a minimal theme you need to edit * trivial to write colorschemes; for a minimal theme you need to edit
@ -67,9 +67,11 @@ values):
> >
let g:airline_detect_paste=1 let g:airline_detect_paste=1
< <
* enable iminsert detection * enable iminsert detection
> >
let g:airline_detect_iminsert=1 let g:airline_detect_iminsert=1
<
* change the default theme * change the default theme
> >