gpt4 book ai didi

windows - 如何在 Windows git-bash 终端上获得彩色输出?

转载 作者:行者123 更新时间:2023-12-02 18:49:57 42 4
gpt4 key购买 nike

如何在输出上获得彩色突出显示?
例如

npm start  
npm test
etc.

npm start example

系统:
Windows 10
Git版本2.16.1.windows.4
节点5.6.0

最佳答案

卸载适用于 Windows 10 的 Git Bash 并再次运行安装程序:

  • 单击“下一步”,直到提示您选择配置终端模拟器以与 Git Bash 一起使用,此处选择使用 Windows 默认控制台窗口(而不是默认的使用 MinTTY 作为终端模拟器的选项)
  • 点击下一步并完成安装

测试是否正常工作:

  • 打开 Git Bash(cmd 将打开),尝试使用 ls 你会看到所有文件夹都显示为蓝色
  • 尝试一下 ANSI escape code通过运行echo -e "\033[44m\033[37m Test\033[0m"],您将看到带有蓝色背景的文本Test,如屏幕截图所示下面

enter image description here

Windows 10 控制台支持 24-bit colorANSI escape sequences

关于windows - 如何在 Windows git-bash 终端上获得彩色输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48749738/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com