Is there a command that can be used to change the color scheme of the Mac OS X Terminal? I like the idea of being able to change colors depending on scripts I run. So far I am just changing the color of my bash prompt with PS1 which is okay but not as noticeable as I'd like.
Macos – OS X Terminal command to change color themes
colorsmacosterminal
Best Answer
Depending on what exactly you want to accomplish, here's a few ideas in AppleScript using your Terminal styles. These are more robust than
tput
, because this gets reset by colored prompts. etc (at least for me).This sets all tabs running Python (no SSH server available for testing right now) to Homebrew, the others to Ocean:
save as script and run as
osascript Name.scpt
anytime you want to re-color your shells (of course you can wrap this as a shell script or something).If you want to display all long-running processes differently, use the following condition:
if busy of tab t of window w is true then
Or, you can set the style of a single tab, manually selected:
Run it like this:
-> Third tab of frontmost Terminal window gets Homebrew style!
If you want to modify background windows, replace "front window" with a parenthesized expression like just after "tab". If you always want to modify the selected "current tab", use
selected tab
instead oftab (item 1 of argv as number)
.Add the following to your
.bash_profile
if the first solution is too manual labour for you:PROMPT_COMMAND='osascript "/path/to/Name.scpt"'
Now it gets executed before every prompt (only problem: not after starting something, i.e.
ssh
. But this topic isn't about fancy bash tricks anyway. This is just a pointer.)