dracula-vim/autoload/airline/themes/dracula.vim

137 lines
3.9 KiB
VimL
Raw Normal View History

" Dracula Airline Theme: {{{
2016-04-04 02:16:54 +00:00
"
" Copyright 2016, All rights reserved
"
" Code licensed under the MIT license
" http://zenorocha.mit-license.org
"
" @author Extrante <extrante@gmail.com>
2016-05-08 07:57:49 +00:00
" @author Zeno Rocha <hi@zenorocha.com>
"}}}
" Helpers: {{{
" Takes a foreground color name, background color name, and optionally one or
" more attr-list items as input, transforms it to the format accepted by
" airline#themes#generate_color_map and returns that value
func! s:clr(fg, bg, ...)
let l:fg = get(g:dracula_palette, a:fg)
let l:bg = get(g:dracula_palette, a:bg)
if ! type(l:fg) == 3
echoerr 'Color undefined in dracula_palette: ' . a:fg
elseif ! type(l:bg) == 3
echoerr 'Color undefined in dracula_palette: ' . a:fg
endif
return [ l:fg[0], l:bg[0], l:fg[1], l:bg[1] ] + filter(copy(a:000), 'type(v:val) == 1 && len(v:val) > 0')
endfunc
" Takes three ['fg', 'bg'] color lists and optionally a dictionary of extra
" key-value pairs and returns the value generated by
" airline#themes#generate_color_map after optionally merging the dictionary of
" extra key-value pairs.
"
" a:a -> airline_a, airline_x
" a:b -> airline_b, airline_y
" a:c -> airline_c, airline_z
func! s:color_map(a, b, c, ...)
if a:0 == 0
return call('airline#themes#generate_color_map', [call('s:clr', a:a), call('s:clr', a:b), call('s:clr', a:c)])
else
return call('extend', [ call('airline#themes#generate_color_map', [call('s:clr', a:a), call('s:clr', a:b), call('s:clr', a:c)]) ] + a:000)
endif
endfunc
"}}}
let g:airline#themes#dracula#palette = {
\ 'normal': s:color_map(
\ ['bg', 'purple'],
\ ['fg', 'comment'],
\ ['fg', 'selection'],
\ {
\ 'airline_warning': s:clr('bg', 'orange'),
\ 'airline_error': s:clr('bg', 'red'),
\ },
\ ),
\ 'normal_modified': s:color_map(
\ ['bg', 'purple'],
\ ['fg', 'comment'],
\ ['fg', 'bgdark'],
\ ),
\ 'insert': s:color_map(
\ ['bg', 'green'],
\ ['fg', 'comment'],
\ ['fg', 'selection'],
\ {
\ 'airline_warning': s:clr('bg', 'orange'),
\ 'airline_error': s:clr('bg', 'red'),
\ },
\ ),
\ 'insert_modified': s:color_map(
\ ['bg', 'green'],
\ ['fg', 'comment'],
\ ['fg', 'bgdark'],
\ ),
\ 'replace': s:color_map(
\ ['bg', 'orange'],
\ ['fg', 'comment'],
\ ['fg', 'selection'],
\ {
\ 'airline_warning': s:clr('bg', 'orange'),
\ 'airline_error': s:clr('bg', 'red'),
\ },
\ ),
\ 'replace_modified': s:color_map(
\ ['bg', 'orange'],
\ ['fg', 'comment'],
\ ['fg', 'bgdark'],
\ ),
\ 'visual': s:color_map(
\ ['bg', 'yellow'],
\ ['fg', 'comment'],
\ ['fg', 'selection'],
\ {
\ 'airline_warning': s:clr('bg', 'orange'),
\ 'airline_error': s:clr('bg', 'red'),
\ },
\ ),
\ 'visual_modified': s:color_map(
\ ['bg', 'yellow'],
\ ['fg', 'comment'],
\ ['fg', 'bgdark'],
\ ),
\ 'inactive': s:color_map(
\ ['fg', 'selection'],
\ ['fg', 'selection'],
\ ['fg', 'selection'],
\ ),
\}
" Extensions: {{{
" Tabline: {{{
if get(g:, 'airline#extensions#tabline#enabled', 0)
let g:airline#themes#dracula#palette.tabline = {
\ 'airline_tabfill': s:clr('bg', 'bg'),
\
\ 'airline_tab': s:clr('comment', 'bg'),
\ 'airline_tabsel': s:clr('white', 'bg', 'bold'),
\ 'airline_tabmod': s:clr('green', 'bg'),
\
\ 'airline_tab_right': s:clr('comment', 'bg'),
\ 'airline_tabsel_right': s:clr('white', 'bg', 'bold'),
\ 'airline_tabmod_right': s:clr('green', 'bg'),
\}
endif
"}}}
" CtrlP: {{{2
if exists('g:loaded_ctrlp')
let g:airline#themes#dracula#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
\ s:clr('fg', 'selection'),
\ s:clr('fg', 'comment'),
\ s:clr('fg', 'purple'),
\)
2016-04-04 02:16:54 +00:00
endif
"}}}2
"}}}
2016-04-04 02:16:54 +00:00
" vim: fdm=marker ts=2 sts=2 sw=2: