~gpanders/dotfiles

ref: 8bbb6b42ada8c7e573ffba9c35b376dd6bec1d15 dotfiles/vim/.vim/autoload/toggle_bg.vim -rw-r--r-- 582 bytes
8bbb6b42Greg Anders Move weechat config directory to .config/weechat 2 years ago
                                                                                
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
" See :h xterm-true-color
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

function! toggle_bg#toggle()
  if exists('g:toggle_bg_dark') && exists('g:toggle_bg_light')
    if !&termguicolors
      set termguicolors
    endif

    if g:colors_name ==# g:toggle_bg_dark
      execute 'colorscheme' g:toggle_bg_light
    else
      execute 'colorscheme' g:toggle_bg_dark
    endif
  else
    " If no colorschemes are defined then just toggle the bg setting
    if &bg ==# 'dark'
      set bg=light
    else
      set bg=dark
    endif
  endif
endfunction