将 zsh 颜色与 dircolors 集成

如何解决将 zsh 颜色与 dircolors 集成

我可以在终端上使用 zsh SHELL 命令生成 256 种颜色的列表:

for code in {000..255}
do
    print -P -- "$code: %F{$code}Color%f"
done

目前,我正在将 dircolors 与 zsh 一起使用:

norMAL 01;37       # global default,although everything should be something.
FILE 01;37         # normal file
DIR 32       # directory
LINK 01;36      # symbolic link
FIFO 40;33      # pipe
SOCK 01;35      # socket
BLK 40;33;01    # block device driver
CHR 40;33;01    # character device driver

# This is for files with execute permission:
EXEC 00;36

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension,a space,and the color init string.
# (and any comments you want to add after a '#')
*~   05;31 # stuff we hate to find laying around (flashing red)
.mtxt 05;31 # crap
.ndx 05;31
.cmd 00;33 # executables
.exe 00;33
.com 00;33
.btm 00;33
.bat 00;33
.txt 00;37
.pdf 04;94
.docx 00;91
.doc 00;91
.xlsx 00;91
.xls 00;91
#.txt 07;40
.c   00;35 # source code
.h   00;35
.sh  00;36
.py  00;36
.cpp  00;35
.pl  00;36
.pm  00;35
.cgi 00;35
.java 00;35
.html 00;35
.tar 00;31 # archives or compressed (bright red)
.tgz 00;31
.arj 00;31
.taz 00;31
.lzh 00;31
.zip 00;31
.z   00;31
.Z   00;31
.gz  00;31
.jpg 01;35 # image formats
.jpeg 01;35
.JPG 01;35
.gif 01;35
.GIF 01;35
.bmp 01;35
.BMP 01;35
.xbm 01;35
.ppm 01;35
.xpm 01;35
.tif 01;35
.png 01;35

如果可能,我如何在 ~/.dircolors 中使用一些颜色来自最初在我的帖子 (loop with print -P -- "$code: %F{$code}Color%f") 中生成的 256 个值?

或者还有其他替代方法可以使用 ~/.dircolors 获得更多颜色吗?

解决方法

dircolors 中使用的数字是 ANSI SGR parameters。阅读链接的文章了解更多信息。它还列出了哪些数字对应于 256 色调色板中的哪些颜色。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?