如果有人仍然感兴趣,可以这样做。 至少现在您可以在扩展设置中指定终端的配置文件:
"restoreTerminals.terminals": [
{
"profile": "Coverage",
"splitTerminals": [
{
"name": "Coverage",
}
]
},
{
"profile": "Server",
"splitTerminals": [
{
"name": "Server",
}
]
}
]
因此,您实际上可以为您想要的每个终端创建一个配置文件,如下所示:
"terminal.integrated.profiles.windows": {
"Coverage": {
"path": ["D:\\Program Files\\Git\\bin\\bash.exe"],
"icon": "beaker",
"color": "terminal.ansiGreen"
},
"Server": {
"path": ["D:\\Program Files\\Git\\bin\\bash.exe"],
"icon": "server",
"color": "terminal.ansiMagenta"
}
},
完成:
此方法不再有效,请参阅下面的方法
我现在使用扩展程序Terminals Manager
你可以看一下文档,但这是我当前的扩展设置:
"terminal.integrated.hideOnStartup": "always",
"terminal.integrated.enablePersistentSessions": false,
"terminals.invertCommandsAndDescription": false,
"terminals.showCommands": false,
"terminals.showDescriptions": true,
"terminals.sortTerminals": false,
"terminals.env": {},
"terminals.multiplexer": "screen",
"workbench.startupEditor": "readme",
"terminals.autorun": true,
"terminals.autokill": true,
最后,您可以单独配置您的终端。这是我的配置:
"terminals.terminals": [
{
"name": "Sonar",
"description": "Terminal to run static analyzer sonar-scanner",
"icon": "checklist",
"color": "terminal.ansiCyan",
"recycle": true
},
{
"name": "Test",
"description": "Terminal to run testes",
"color": "terminal.ansiGreen",
"icon": "beaker",
"command": "npm run testCov",
"execute": false,
"recycle": true
},
{
"name": "Server",
"description": "Terminal to run the current program",
"color": "terminal.ansiMagenta",
"icon": "server",
"command": "npm run startDev",
"execute": false,
"recycle": true,
"focus": true
},
{
"name": "Git",
"description": "Terminal to run git and other misc commands",
"color": "terminal.ansiYellow",
"icon": "git-branch",
"recycle": true
}
],
在 settings.json 文件中,您可以指定配置文件中图标的
icon
和 color
。 例如:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash",
"icon": "terminal-bash", //what icon to use
"color": "terminal.ansiGreen" //color of icon
}
},
"terminal.integrated.defaultProfile.windows": "Git Bash",
使用您链接到的扩展会产生如下结果(使用他们在扩展文档中列出的示例 json 设置):
看起来该扩展使用了您的默认终端配置文件(实际上查看其源代码,它甚至不知道默认配置文件是什么,只是调用 VS Code API 命令来生成新终端),并应用所述配置文件的设置,因此您将仅限于一种颜色/图标。
,我的问题的目的是能够更改每个图标和颜色,api 应该是黄色,云蓝色,...我确实更新了我的问题,以便更准确地描述我尝试存档的内容。
如果可行,那不是 VSCode 本身,而是通过扩展。
microsoft/vscode
问题 127951)很清楚:
作为扩展关闭可以做到这一点
OP 补充道:
为了使其可行,我们首先需要了解如何通过 api 更改颜色