如何在VS Code的macOS zsh集成终端中修改代码输出颜色?
在VS Code(macOS)中单独修改zsh集成终端的代码输出颜色
我想修改VS Code(macOS)里zsh集成终端的代码输出颜色,方便区分脚本输出和终端原有信息。修改主题、文本/背景/光标颜色都很简单,但单独改代码输出颜色却遇到了麻烦。
首先我在settings.json里尝试了以下配置:
"terminal.integrated.shellArgs.windows": [ "-dumb", "-c", "echo -e '\\e[31m'" ]
但VS Code提示:
This is now deprecated. recommendation tells: 'the new recommended way to configure your default shell is by creating a terminal profile in
terminal.integrated.profiles.windowsand setting its profile name as the default interminal.integrated.defaultProfile.windows. This will currently take priority over the new profiles settings but that will change in the future.`
接下来我改用终端配置文件的方式,尝试了如下配置:
"zsh": { "path": "zsh", "args": [ "-l", "echo '\u001b[31m'" ] }
但终端启动失败,报错:
The terminal process "/bin/zsh '-l', 'echo '[31m''" failed to launch (exit code: 127).
我知道可以在代码里通过ANSI转义序列实现颜色输出,比如Python里这么写:
print("\033[34mHello, world!\033[0m")
但我想知道,能不能直接通过VS Code的设置来实现单独修改代码输出颜色?
内容的提问来源于stack exchange,提问作者Sanny Wind
相关产品推荐
相关产品推荐

