Skip to content

Instantly share code, notes, and snippets.

@jleedev
Last active January 23, 2019 13:33
Show Gist options
  • Save jleedev/f597ecf97889640ac6ce0151be2c4992 to your computer and use it in GitHub Desktop.
Save jleedev/f597ecf97889640ac6ce0151be2c4992 to your computer and use it in GitHub Desktop.
dark mode
function! SetMode()
call system("defaults read -g AppleInterfaceStyle")
if v:shell_error
se bg=light
else
se bg=dark
endif
endfunction
call SetMode()
defaults read -g AppleInterfaceStyle 2>&- >&-
if (( $? ))
then
# light mode
export COLORFGBG='0;15'
else
# dark mode
export COLORFGBG='15;0'
fi
SendEnv COLORFGBG
set -g update-environment COLORFGBG
AcceptEnv COLORFGBG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment