Created
November 20, 2020 16:44
-
-
Save saitonakamura/a8254da13523b120055c414b33094dd6 to your computer and use it in GitHub Desktop.
Sets iTerm2 color preset based on MacOS setting
This file contains 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
# Paste in your .bashrc/.zshrc | |
# Change to your color presets | |
ITERM2_DARK_PRESET='OneHalfDark' | |
ITERM2_LIGHT_PRESET='OneHalfLight' | |
theme=`defaults read -g AppleInterfaceStyle` &>/dev/null | |
if [ "$theme" = 'Dark' ] ; then | |
theme='dark' | |
else | |
theme='light' | |
fi | |
if [ "$theme" = 'dark' ] ; then | |
echo -e "\033]1337;SetColors=preset=$ITERM2_DARK_PRESET\a" | |
else | |
echo -e "\033]1337;SetColors=preset=$ITERM2_LIGHT_PRESET\a" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment