打开新标签页时如何更改终端背景颜色? [英] How to change Terminal background color when I open new tab?
问题描述
我想通过ssh登录到远程服务器时更改颜色.
I wanted to change color when I login to remote server by ssh.
这个问题解决了这个问题.
The problem solved by this question.
But the solution above have a little problem.
- 通过SSH连接到远程服务器. (背景颜色已更改)
- 打开新的终端标签.
- 此标签的背景仍然更改.
因此,当我打开新的终端标签"时,我想重置"背景色. 我该怎么办?
So I want to "reset" background color when I open new Terminal Tab. How can I do it?
推荐答案
默认情况下,终端使用与当前选项卡相同的设置创建新的选项卡.您可以通过将新标签页打开方式更改为默认设置,在首选项>启动中将其更改为始终将默认配置文件用于新标签页.
By default, 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 > Startup by changing New tabs open with: to Default Settings.
请注意,有一种内置方法可以自动为特定命令设置背景颜色,而不是使用其他答案中的脚本:
Note that there’s a built-in way to automatically set the background color for specific commands instead of using the script from that other answer:
您可以将设置配置文件的名称设置为命令名称,并且当您通过 Shell> New Command ... 或 Shell> New Remote创建新终端时,终端将选择该配置文件.连接... .
You can set the name of a settings profile to a command name and Terminal will select that profile when you create a new terminal via either Shell > New Command… or Shell > New Remote Connection….
例如,复制您的默认配置文件,将其命名为"ssh",并将其背景色设置为红色.然后使用 New Command…(运行新命令…)运行ssh host.example.com
.
For example, duplicate your default profile, name it "ssh" and set its background color to red. Then use New Command… to run ssh host.example.com
.
它也与参数匹配,因此,例如,您可以让它为不同的远程主机选择不同的设置.您可能有一个名为"ssh host.example.com"的蓝色背景,另一个名为"ssh"的背景为红色,以处理与其他配置文件不匹配的任何ssh命令.
It also matches on arguments, so you can have it choose different settings for different remote hosts, for example. You could have one named "ssh host.example.com" with a blue background and another named "ssh" with a red background to handle any ssh commands that don’t match other profiles.
这篇关于打开新标签页时如何更改终端背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!