Ben*_*enj 4 bash shell terminfo tput
我正在寻找包含此内容的文件
export fgBlack8="$(tput setf 0)";
export fgRed8="$(tput setf 1)";
export fgGreen8="$(tput setf 2)";
export fgYellow8="$(tput setf 3)";
export fgBlue8="$(tput setf 4)";
export fgMagenta8="$(tput setf 5)";
export fgCyan8="$(tput setf 6)";
export fgWhite8="$(tput setf 7)";
export bgBlack8="$(tput setb 0)";
export bgRed8="$(tput setb 1)";
export bgGreen8="$(tput setb 2)";
export bgYellow8="$(tput setb 3)";
export bgBlue8="$(tput setb 4)";
export bgMagenta8="$(tput setb 5)";
export bgCyan8="$(tput setb 6)";
export bgWhite8="$(tput setb 7)";
Run Code Online (Sandbox Code Playgroud)
根据此链接:https://linux.101hacks.com/ps1-examples/prompt-color-using-tput/
然后,当用这样的几个命令测试颜色时
echo -e "${fgBlack8}fgBlack8"
echo -e "${fgRed8}fgRed8"
echo -e "${fgGreen8}fgGreen8"
echo -e "${fgYellow8}fgYellow8"
echo -e "${fgBlue8}fgBlue8"
echo -e "${fgMagenta8}fgMagenta8"
echo -e "${fgCyan8}fgCyan8"
echo -e "${fgWhite8}fgWhite8"
Run Code Online (Sandbox Code Playgroud)
我收到以下输出:
将红色显示为蓝色,将黄色显示为青色,反之亦然。网站上的代码是否错误,或者我是否使用错误并意外生成了正确的颜色映射?
如果您使用tput
命令,那么从以下开始是合乎逻辑的
$ man tput
Run Code Online (Sandbox Code Playgroud)
SEE ALSO 将带您前往
$ man terminfo
Run Code Online (Sandbox Code Playgroud)
你会发现
setaf/setab 和 setf/setb 功能各自采用一个数字参数。终端硬件可以随意映射这些,但 RGB 值表示颜色空间中的正常位置。
Run Code Online (Sandbox Code Playgroud)Color #define Value RGB black COLOR_BLACK 0 0, 0, 0 red COLOR_RED 1 max,0,0 green COLOR_GREEN 2 0,max,0 yellow COLOR_YELLOW 3 max,max,0 blue COLOR_BLUE 4 0,0,max magenta COLOR_MAGENTA 5 max,0,max cyan COLOR_CYAN 6 0,max,max white COLOR_WHITE 7 max,max,max
setf/setb 的参数值历史上对应于不同的映射,即
Run Code Online (Sandbox Code Playgroud)Color #define Value RGB black COLOR_BLACK 0 0, 0, 0 blue COLOR_BLUE 1 0,0,max green COLOR_GREEN 2 0,max,0 cyan COLOR_CYAN 3 0,max,max red COLOR_RED 4 max,0,0 magenta COLOR_MAGENTA 5 max,0,max yellow COLOR_YELLOW 6 max,max,0 white COLOR_WHITE 7 max,max,max
归档时间: |
|
查看次数: |
8090 次 |
最近记录: |