我想通过log.graphColors
自定义git log --graph
中使用的颜色。基本上,我需要保留默认颜色,只需排除蓝色,因为它在我的终端中几乎不可读。最干净的方法是什么?
这是原始颜色集:
red,green,yellow,blue,magenta,cyan,bold red,bold green,bold yellow,bold blue,bold magenta,bold cyan
您可以跳过蓝色并在.gitconfig
文件中设置以下内容:
[log]
graphColors = red,green,yellow,magenta,cyan,bold red,bold green,bold yellow,bold magenta,bold cyan
不幸的是,目前无法获取git
配置变量的默认值(有关更多信息和链接,请参阅此答案(。
您可以检查/尝试的事情:
您的终端是否正在改变颜色?
可能是
ANSI color escape sequence
蓝色在您的终端中没有显示为蓝色。检查这一点的一种简单方法可能是使用# set current branch color to blue git config color.branch.current blue git branch # check the color of the branch and then reset it git config --unset color.branch.current # or to try colors more genaral (note the quotes) git config color.branch.current '[<attribute>,..] <color> <color>' git branch
<attribute>
可用的bold, dim, ul, blink, reverse, italic, and strike
。这里特别说明bold
例如,iTerm2使用明亮列(在颜色设置选项卡中(中指定的颜色来bold
颜色<color>
可用的normal, black, red, green, yellow, blue, magenta, cyan and white
。第一个是前景色,第二个是背景色如果是:了解如何更改终端中的颜色
使用您喜欢的颜色列表(省略蓝色(设置选项并享受
我希望你找到了一个令人满意的解决方案,或者至少是一些有趣的阅读。
在 Konsole 中,您可以简单地调整配置文件中的配色方案,使蓝色稍微浅一点。转到"设置">"编辑当前配置文件...">"外观"。在那里,选择您的颜色主题并根据您的喜好进行编辑。
这不仅可以解决git
的问题,还可以解决任何其他使用彩色输出的终端应用程序的问题。