在哪里可以找到所有颜色组合的列表或可用于 ack(-grep)
的列表?我发现通过 ack-grep
传递日志对于检测错误、警告或各种其他情况非常有帮助,尤其是在着色方面,但是我还没有找到可以使用哪些组合等的权威列表.
tail -f development.log \
| ack-grep --flush --passthru --color --color-match=yellow "^.*warning.*"
我见过一些选项,例如标准颜色:red
、blue
、yellow
、green
,等等
而且我看到您可以使用 "white on_green"
还有什么?
最佳答案
ack 使用 Perl 的 Term::ANSIColor
模块,因此您可以使用以下方法检查可用的内容:
perldoc Term::ANSIColor
这是相关的摘录。
The recognized normal foreground color attributes (colors 0 to 7) are:
black red green yellow blue magenta cyan white
The corresponding bright foreground color attributes (colors 8 to 15)
are:
bright_black bright_red bright_green bright_yellow
bright_blue bright_magenta bright_cyan bright_white
The recognized normal background color attributes (colors 0 to 7) are:
on_black on_red on_green on_yellow
on_blue on_magenta on_cyan on_white
The recognized bright background color attributes (colors 8 to 15) are:
on_bright_black on_bright_red on_bright_green on_bright_yellow
on_bright_blue on_bright_magenta on_bright_cyan on_bright_white
For any of the above listed attributes, case is not significant.
很高兴看到您也使用 --passthru
。
我们欢迎您调用 ack-users mailing list
关于bash - ack(-grep) 有哪些颜色选项用于输出、日志等的着色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9625316/