How to change terminal background color when opening a new tab?

I wanted to change color when logging in to a remote server using ssh.

The problem is resolved by this issue.

How to automatically change the color scheme of the Apple terminal window when I ssh on a specific server

But the solution above has a little problem.

  • Connect to a remote server via ssh. (Background color changed)
  • Open a new terminal tab.
  • This tab background is still changing.

So, I want to "reset" the background color when opening a new terminal tab. How can i do this?

+1
terminal ssh macos
source share
1 answer

By default, the terminal creates new tabs with the same settings as the current tab. You can change it to always use your default profile for new tabs in Preferences> Launch by changing New Tabs from: to Default Settings .

Note that this is a built-in way to automatically set the background color for certain commands instead of using the script from this other answer:

You can set the name of the settings profile to the name of the command, and Terminal will select this profile when creating a new terminal using Shell> New command ... or Shell> New remote Connection ....

For example, duplicate your default profile, name it "ssh" and set its background color to red. Then use the New command ... to run ssh host.example.com .

It also matches the arguments, so you can choose, for example, different settings for different remote hosts. You can have one with the name "ssh host.example.com" with a blue background, and another with the name "ssh" with a red background to handle any ssh commands that do not match other profiles.

+3
source share

All Articles