improve algorithm for inactive colors. resolves #178.
This commit is contained in:
parent
e8d0d24163
commit
30c3613924
@ -5,19 +5,17 @@ let s:prototype = {}
|
|||||||
|
|
||||||
function! s:prototype.split(gutter)
|
function! s:prototype.split(gutter)
|
||||||
let self._side = 0
|
let self._side = 0
|
||||||
let self._line .= '%#'.self._group(self._curgroup).'#'.a:gutter
|
let self._line .= '%#'.self._curgroup.'#'.a:gutter
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:prototype.add_section(group, contents)
|
function! s:prototype.add_section(group, contents)
|
||||||
if self._curgroup != ''
|
if self._curgroup != ''
|
||||||
call self._highlighter.add_separator(self._group(self._curgroup), self._group(a:group), self._side)
|
call self._highlighter.add_separator(self._curgroup, a:group, self._side)
|
||||||
let self._line .= '%#'.self._group(self._curgroup).'_to_'.self._group(a:group).'#'
|
let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#'
|
||||||
let self._line .= self._side
|
let self._line .= self._side ? g:airline_left_sep : g:airline_right_sep
|
||||||
\ ? self._active ? g:airline_left_sep : g:airline_left_alt_sep
|
|
||||||
\ : self._active ? g:airline_right_sep : g:airline_right_alt_sep
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self._line .= '%#'.self._group(a:group).'#'.a:contents
|
let self._line .= '%#'.a:group.'#'.a:contents
|
||||||
let self._curgroup = a:group
|
let self._curgroup = a:group
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -25,11 +23,10 @@ function! s:prototype.add_raw(text)
|
|||||||
let self._line .= a:text
|
let self._line .= a:text
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:prototype._group(group)
|
|
||||||
return self._active ? a:group : a:group.'_inactive'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:prototype.build()
|
function! s:prototype.build()
|
||||||
|
if !self._active
|
||||||
|
let self._line = substitute(self._line, '%#.\{-}\ze#', '\0_inactive', 'g')
|
||||||
|
endif
|
||||||
return self._line
|
return self._line
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ function! airline#extensions#readonly#get_mark()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#readonly#init()
|
function! airline#extensions#readonly#init()
|
||||||
let g:airline_section_gutter = ' %#airline_file#%{airline#extensions#readonly#get_mark()}%#airline_c# '
|
let g:airline_section_gutter = ' %#airline_file#%{airline#extensions#readonly#get_mark()} '
|
||||||
\ .g:airline_section_gutter
|
\ .g:airline_section_gutter
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@ function! airline#highlighter#exec(group, colors)
|
|||||||
\ get(colors, 4, '') != '' ? 'term='.colors[4] : '')
|
\ get(colors, 4, '') != '' ? 'term='.colors[4] : '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:exec_separator(dict, from, to, inverse)
|
function! s:exec_separator(dict, from, to, inverse, suffix)
|
||||||
let l:from = airline#themes#get_highlight(a:from)
|
let l:from = airline#themes#get_highlight(a:from.a:suffix)
|
||||||
let l:to = airline#themes#get_highlight(a:to)
|
let l:to = airline#themes#get_highlight(a:to.a:suffix)
|
||||||
let group = a:from.'_to_'.a:to
|
let group = a:from.'_to_'.a:to.a:suffix
|
||||||
if a:inverse
|
if a:inverse
|
||||||
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
|
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
|
||||||
else
|
else
|
||||||
@ -68,7 +68,7 @@ function! airline#highlighter#new()
|
|||||||
|
|
||||||
" TODO: optimize this
|
" TODO: optimize this
|
||||||
for sep in items(self._separators)
|
for sep in items(self._separators)
|
||||||
call <sid>exec_separator(dict, sep[1][0].suffix, sep[1][1].suffix, sep[1][2])
|
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -58,13 +58,13 @@ function! airline#themes#patch(palette)
|
|||||||
" colors from 'airline_c' into it.
|
" colors from 'airline_c' into it.
|
||||||
for mode in keys(a:palette)
|
for mode in keys(a:palette)
|
||||||
let overrides = split(mode, '_')
|
let overrides = split(mode, '_')
|
||||||
if len(overrides) > 1
|
let mode_colors = a:palette[overrides[0]]
|
||||||
let mode_colors = a:palette[overrides[0]]
|
if exists('mode_colors.airline_file')
|
||||||
if exists('mode_colors.airline_file')
|
let file_colors = mode_colors.airline_file
|
||||||
let file_colors = mode_colors.airline_file
|
let file_colors[1] = mode_colors.airline_c[1]
|
||||||
let file_colors[1] = mode_colors.airline_c[1]
|
let file_colors[3] = mode_colors.airline_c[3]
|
||||||
let file_colors[3] = mode_colors.airline_c[3]
|
|
||||||
|
|
||||||
|
if len(overrides) > 1
|
||||||
let override_colors = a:palette[overrides[0].'_'.overrides[1]]
|
let override_colors = a:palette[overrides[0].'_'.overrides[1]]
|
||||||
let override_colors.airline_file = copy(file_colors)
|
let override_colors.airline_file = copy(file_colors)
|
||||||
let override_status_colors = get(override_colors, 'airline_c', mode_colors.airline_c)
|
let override_status_colors = get(override_colors, 'airline_c', mode_colors.airline_c)
|
||||||
|
@ -80,8 +80,10 @@ let g:airline#themes#dark#palette.visual_modified = {
|
|||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
|
||||||
let s:IA = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
let s:IA1 = [ '#606060' , '#1c1c1c' , 239 , 234 , '' ]
|
||||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
let s:IA2 = [ '#4e4e4e' , '#1c1c1c' , 239 , 235 , '' ]
|
||||||
|
let s:IA3 = [ '#4e4e4e' , '#1c1c1c' , 239 , 236 , '' ]
|
||||||
|
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3, s:file)
|
||||||
|
|
||||||
|
|
||||||
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
||||||
|
@ -38,6 +38,7 @@ let g:airline#themes#simple#palette.visual = airline#themes#generate_color_map(s
|
|||||||
let g:airline#themes#simple#palette.visual_modified = copy(g:airline#themes#simple#palette.normal_modified)
|
let g:airline#themes#simple#palette.visual_modified = copy(g:airline#themes#simple#palette.normal_modified)
|
||||||
|
|
||||||
|
|
||||||
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ]
|
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ]
|
||||||
let g:airline#themes#simple#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
let s:IA2 = [ '#4e4e4e' , s:guibg2 , 239 , s:termbg2 , '' ]
|
||||||
|
let g:airline#themes#simple#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2, s:file)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user