Improve contrast for base16 theme

fixes 54
This commit is contained in:
Christian Brabandt 2016-10-14 12:37:50 +02:00
parent 3e8ecba0de
commit bf34040747
2 changed files with 67 additions and 29 deletions

View File

@ -1,31 +1,40 @@
let s:improved_contrast = get(g:, 'airline_base16_improved_contrast', 0)
" Color palette
let s:gui_dark_gray = '#202020'
let s:cterm_dark_gray = 234
let s:gui_med_gray_hi = '#303030'
let s:cterm_med_gray_hi = 236
let s:gui_med_gray_lo = '#3a3a3a'
let s:cterm_med_gray_lo = 237
let s:gui_light_gray = '#505050'
let s:cterm_light_gray = 239
let s:gui_lightlight_gray = '#8A8A8A'
let s:cterm_lightlight_gray = 245
let s:gui_green = '#99cc99'
let s:cterm_green = 151
let s:gui_blue = '#6a9fb5'
let s:cterm_blue = 67
let s:gui_purple = '#aa759f'
let s:cterm_purple = 139
let s:gui_orange = '#d28445'
let s:cterm_orange = 173
let s:gui_red = '#ac4142'
let s:cterm_red = 131
let s:gui_pink = '#d7afd7'
let s:cterm_pink = 182
if get(g:, 'airline#themes#base16#constant', 0)
let g:airline#themes#base16#palette = {}
" Color palette
let s:gui_dark_gray = '#202020'
let s:cterm_dark_gray = 234
let s:gui_med_gray_hi = '#303030'
let s:cterm_med_gray_hi = 236
let s:gui_med_gray_lo = '#3a3a3a'
let s:cterm_med_gray_lo = 237
let s:gui_light_gray = '#505050'
let s:cterm_light_gray = 239
let s:gui_green = '#99cc99'
let s:cterm_green = 151
let s:gui_blue = '#6a9fb5'
let s:cterm_blue = 67
let s:gui_purple = '#aa759f'
let s:cterm_purple = 139
let s:gui_orange = '#d28445'
let s:cterm_orange = 173
let s:gui_red = '#ac4142'
let s:cterm_red = 131
let s:gui_pink = '#d7afd7'
let s:cterm_pink = 182
" Normal mode
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green]
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo]
if s:improved_contrast
let s:N2 = [s:gui_lightlight_gray, s:gui_med_gray_lo, s:cterm_lightlight_gray, s:cterm_med_gray_lo]
else
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo]
endif
let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi]
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#base16#palette.normal_modified = {
@ -55,7 +64,11 @@ if get(g:, 'airline#themes#base16#constant', 0)
let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified)
" Inactive window
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, '']
if s:improved_contrast
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_lightlight_gray, s:cterm_med_gray_hi, '']
else
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_light_gray, s:cterm_med_gray_hi, '']
endif
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
let g:airline#themes#base16#palette.inactive_modified = {
\ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''],
@ -98,10 +111,14 @@ else
" Use VertSplit's bg and default fg (reversed) for inactive statusline.
let s:VS = airline#themes#get_highlight('VertSplit')
let s:IA = [ s:VS[1], 'NONE', s:VS[2], 'NONE', 'reverse']
if s:improved_contrast
let s:IA = [ s:VS[1], 'NONE', s:VS[2], s:cterm_lightlight_gray, 'reverse']
else
let s:IA = [ s:VS[1], 'NONE', s:VS[2], 'NONE', 'reverse']
endif
let g:airline#themes#base16#palette.inactive =
\ airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:IA, s:IA, s:IA)
let s:IM = [ s:VS[1], 'NONE', s:VS[2], 'NONE', 'reverse,italic']
let s:IM = [ s:VS[1], 'NONE', s:VS[2], 'NONE', 'reverse']
let g:airline#themes#base16#palette.inactive_modified =
\ airline#themes#generate_color_map(s:IM, s:IM, s:IM, s:IM, s:IM, s:IM)

View File

@ -26,7 +26,7 @@ FEATURES *airline-themes-list*
Currently this repository contains the following themes:
* badwolf
* base16
* base16(|airline-theme-base16|)
* base16_3024
* base16_apathy
* base16_ashes
@ -109,7 +109,7 @@ g:airline_theme in your |.vimrc| like this: >
:let g:airline_theme='dark'
<
|airline-theme-solarized|
*airline-theme-solarized*
*g:solarized_base16*
Base16 has a Solarized theme with the usual colors, but mapped in the
@ -129,13 +129,34 @@ look more like classic powerline in normal mode. To enable it:
>
let g:airline_solarized_normal_green = 1
g:airline_solarized_dark_inactive_border
*g:airline_solarized_dark_inactive_border*
Changes inactive window panes to have a dark bottom border instead
of light by default. To enable it:
>
let g:airline_solarized_dark_inactive_border = 1
*airline-theme-base16*
Base16 is a popular theme from Chris Kempson
(https://github.com/chriskempson/base16-vim)
The default theme is base16, all other base16-themes have been generated and
might not support all options.
*g:airline_base16_improved_contrast*
Improves the contrast for the inactive statusline. To enable it: >
let g:airline_base16_improved_contrast = 1
<
*airline#themes#base16#constant*
Uses a predefined colorpalette for defining the colors, instead of guessing
the values from other highlight groups. To enable it: >
let g:airline#themes#base16#constant = 1
<
==============================================================================
CONTRIBUTIONS *airline-themes-contributions*