amdt/sunset — pull request #1 by delphinus35 (2012-10-28 04:46:06+00:00)
Title: callback when s:sunset() will be called

I'm using Solarized and [Powerline][powerline] with [Solarized colorscheme][solarized-theme].

vim-sunset plugin works great for Solarized and change light and dark theme, but Powerline doesn't change his theme automatically.

So I created callback control in `s:sunset()`. This commit and sample code below make Powerline change his theme when `&bg` will be changed.

```vim
let g:sunset_last_background = ''
function! g:sunset_callback()
if g:sunset_last_background != &bg && exists(':PowerlineReloadColorscheme')
let g:sunset_last_background = &bg
let g:Powerline_colorscheme = &background == 'light' ? 'solarizedLight' : 'solarizedDark'
PowerlineReloadColorscheme
endif
endfunction
```

[powerline]: https://github.com/Lokaltog/vim-powerline "Lokaltog/vim-powerline"
[solarized-theme]: https://github.com/Lokaltog/vim-powerline/pull/162 "Solarized colorscheme by patricklewis · Pull Request #162 · Lokaltog/vim-powerline"