Created
July 7, 2021 08:25
-
-
Save chaidhat/78d45a4c345f0a9e9e985fb69cccc26d to your computer and use it in GitHub Desktop.
Mac OS Terminal which changes theme based on dark mode
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
DARKMODE=$(defaults read -g AppleInterfaceStyle) | |
# actually an || or && function could've worked as Light mode throws an error. but i wanted to show off | |
if [ "$DARKMODE" = "Dark" ]; then | |
osascript -e ' | |
tell application "Terminal" | |
set current settings of selected tab of window 1 to settings set "Basic Dark" | |
end tell | |
' `pwd` | |
else | |
osascript -e ' | |
tell application "Terminal" | |
set current settings of selected tab of window 1 to settings set "Basic Light" | |
end tell | |
' `pwd` | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please replace "Basic Dark" and "Basic Light" with the NAME of your respective theme. Please leave a star, thanks!