Jan 22, 2026ΒΆ
For years I had these lines in my ~/.vimrc:
set background=dark
" set background=light
I would go and move the comment to the other line whenever I needed to switch to another mode. Until today, I discovered this jewel from Vinit Kumar:
function! ChangeBackground()
if system("defaults read -g AppleInterfaceStyle") =~ '^Dark'
set background=dark
else
set background=light
endif
endfunction
call ChangeBackground()
It detects the current Appearance setting and picks the corresponding Solarized theme.
Thank you, Vinit! And thanks to hnpwd for connecting me with Vinit!