1

Is it possible to set the theme of the OS X Terminal depending on what you are doing? I would like to have visual cues to avoid making mistakes.

For example,

  • "pro" theme as default
  • "blue" if you are connected to another server via SSH
  • "red" if you have root rights
  • et cetera
slhck
  • 235,242

2 Answers2

1

You can do what I suggest in this answer and programmatically change the themes of Terminal. Combine with shell aliases, scripts or functions that wrap calls to e.g. ssh to have automated theme changes.


You can also configure themes to execute specific commands when they're launched, so you get an "SSH Theme" executing ssh, a "root theme" that automatically runs sudo bash or something similar.

enter image description here

Daniel Beck
  • 111,893
0

Adding lines like these in your .bash_profile should do the trick:

alias sudo="osascript -e 'tell application \"Terminal\" to set current settings of front window to settings set \"Red Sands\"' && sudo"
alias su="osascript -e 'tell application \"Terminal\" to set current settings of front window to settings set \"Red Sands\"' && su"
alias ssh="osascript -e 'tell application \"Terminal\" to set current settings of front window to settings set \"Ocean\"' && ssh"
user210782
  • 101
  • 1