Change your Terminal.app theme when sshing (Example)

1 min read Original article ↗

With this little snippet inside your .zshrc your Terminal will switch to another Theme when sshing (and it will switch back automagically after exiting).

# Change theme of Terminal.app
tabc() {
  NAME="${1:-Default}"
  osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\""
}

# Change to Danger theme when executing ssh
ssh() {
  tabc Danger
  /usr/bin/ssh "$*"
  tabc
}

Change your Terminal.app theme when sshing