summary refs log tree commit diff
path: root/.vim/autoload/daymode.vim
blob: 40fb5a0b36a3c5c5671464be65ec07c7fb68782d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function! s:lightline_update(colors)
    if !exists('g:loaded_lightline')
        return
    endif
    try
        let g:lightline.colorscheme = a:colors
        call lightline#init()
        call lightline#colorscheme()
        call lightline#update()
    catch
    endtry
endfunction

function! daymode#switch(bang)
    if a:bang
        set background=dark
        execute 'colorscheme' get(g:, 'daymode_colorscheme_night', 'default')
        call s:lightline_update(get(g:, 'daymode_lightline_colorscheme_night', 'PaperColor'))
    else
        set background=light
        execute 'colorscheme' get(g:, 'daymode_colorscheme_day', 'default')
        call s:lightline_update(get(g:, 'daymode_lightline_colorscheme_day', 'PaperColor'))
    endif

    if exists("syntax_on")
        syntax reset
    endif
endfunction