[英]Git support for ANSI colors in default mac terminal
I modified default output of git log
, to this: 我将
git log
默认输出修改为:
git log --pretty=format:'- %C(#00C853)[%ad] %Creset%s' --date=format:'%Y-%m-%d %H:%M:%S'
In this format, default mac terminal does not display colors, but iTerm does. 在这种格式下,默认的mac终端不显示颜色,但iTerm可以显示颜色。
As far as I understand, the problem is with rendering ANSI colors in default mac terminal. 据我了解,问题在于在默认的mac终端中渲染ANSI颜色。
Is there a way to make git support for ANSI colors? 有没有办法使git支持ANSI颜色?
From git-config... 从git-config ...
Colors may also be given as numbers between 0 and 255;
颜色也可以指定为0到255之间的数字。 these use ANSI 256-color mode (but note that not all terminals may support this).
它们使用ANSI 256色模式(但请注意,并非所有终端都可以支持此模式)。 If your terminal supports it, you may also specify 24-bit RGB values as hex, like #ff0ab3 .
如果您的终端支持,还可以将24位RGB值指定为十六进制,例如#ff0ab3 。
I don't know how to get the Mac terminal to support Git's 24-bit RBG colors. 我不知道如何使Mac终端支持Git的24位RBG颜色。
You can use the built in colors like %Cgreen
. 您可以使用
%Cgreen
这样的内置颜色。 Or you can use the closest 256-color like %C(35)
. 或者,您可以使用最接近的256色(如
%C(35)
。
You can also turn on colors in general in your .gitconfig
, though this has been the default since 1.8.4. 您通常也可以在
.gitconfig
打开颜色,尽管这是自1.8.4起的默认设置。
[color]
# Turn on colors as applicable
ui = auto
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.