From a5fe4d99724f0408d34d940f292741c274187654 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sun, 4 Aug 2013 19:10:44 +0000 Subject: [PATCH] extract colors from normal if undefined (#67, #113). --- README.md | 2 +- autoload/airline/themes.vim | 12 ++++++++++-- autoload/airline/themes/tomorrow.vim | 4 ++-- doc/airline.txt | 4 +++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3f799fa2..4d1dc1d5 100644 --- a/README.md +++ b/README.md @@ -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. * 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. -* 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 # Rationale diff --git a/autoload/airline/themes.vim b/autoload/airline/themes.vim index ed71eb37..668f8eb4 100644 --- a/autoload/airline/themes.vim +++ b/autoload/airline/themes.vim @@ -19,9 +19,17 @@ function! s:get_syn(group, what) endfunction 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') - \ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ] - \ : [ '', '', a:fg >= 0 ? a:fg : '', a:bg >= 0 ? a:bg : '', join(a:opts, ',') ] + \ ? [ fg, bg, '', '', join(a:opts, ',') ] + \ : [ '', '', fg, bg, join(a:opts, ',') ] endfunction function! airline#themes#get_highlight(group, ...) diff --git a/autoload/airline/themes/tomorrow.vim b/autoload/airline/themes/tomorrow.vim index 7f532bfe..467ec2a9 100644 --- a/autoload/airline/themes/tomorrow.vim +++ b/autoload/airline/themes/tomorrow.vim @@ -2,7 +2,7 @@ function! s:generate() let s:file = airline#themes#get_highlight('Constant') let s:N1 = airline#themes#get_highlight('DiffDelete', 'bold') 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_modified = { \ '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_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) endfunction diff --git a/doc/airline.txt b/doc/airline.txt index a06b2c51..83db7055 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -13,7 +13,7 @@ FEATURES *airline-features* * integrates with many popular plugins. * looks good with regular fonts, and provides configuration points so you 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 tweak it to your needs. * trivial to write colorschemes; for a minimal theme you need to edit @@ -67,9 +67,11 @@ values): > let g:airline_detect_paste=1 < + * enable iminsert detection > let g:airline_detect_iminsert=1 +< * change the default theme >