Last active
April 25, 2022 21:00
-
-
Save McFrappe/7110b4ef5175168aaed80969b3027e92 to your computer and use it in GitHub Desktop.
Set VIM theme depending on OS theme mode. Checks OSX value `AppleInterfaceStyle` and acts accordingly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" COLORS AND THEMING ########################################################## | |
function! SetBackgroundMode(...) | |
let g:new_bg = "light" | |
let g:ayucolor = "light" # If your theme supports light mode | |
let s:mode = systemlist("defaults read -g AppleInterfaceStyle")[0] | |
if s:mode ==? "Dark" | |
let g:ayucolor = "dark" # If your theme supports dark mode | |
let g:new_bg = "dark" | |
endif | |
if &background !=? g:new_bg | |
let &background = g:new_bg | |
endif | |
colorscheme ayu #Set your theme here | |
hi Normal guibg=NONE ctermbg=NONE | |
endfunction | |
call SetBackgroundMode() | |
call timer_start(30000,"SetBackgroundMode", {"repeat": -1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment