我正在尝试将某些内容设置为灰色,但不知道如何设置。手册页中关于颜色的唯一信息是:
message-bg colour
Set status line message background colour, where colour is one of:
black, red, green, yellow, blue, magenta, cyan, white, colour0 to
colour255 from the 256-colour palette, or default.
Run Code Online (Sandbox Code Playgroud)
cYr*_*rus 254
您可以使用此bash
代码段获取列表:
for i in {0..255}; do
printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n"
done
Run Code Online (Sandbox Code Playgroud)
然后colourxxx
与tmux
.
Edd*_*ker 119
我发现这张图片很有启发性。
小智 25
在 Subversion(将是 tmux 1.5)中,您还可以使用 #abcdef 十六进制样式的颜色,这些颜色映射到最近的 256 调色板条目。您需要引号,因为它被视为字符串,而常规颜色名称被视为命名常量。另请注意,3 个字母的速记 (#f00) 无效。
例子:
set pane-active-border-bg red # no quotes for name
set pane-active-border-bg "#ff0000" # quotes for rgb
Run Code Online (Sandbox Code Playgroud)
小智 15
在 tmux 3.2(2021 年 4 月发布)之前,tmux 仅支持 256 调色板的国际(英式)拼写,例如
"colour121"
Run Code Online (Sandbox Code Playgroud)
而不是在美国的拼写是下降的u
"color121"
Run Code Online (Sandbox Code Playgroud)
如果您使用 tmux 3.2 或更高版本,则可以任意拼写。
基于@cYrus 的回答,我编写了一个脚本将颜色的输出分成 N 列,其中 N 是第一个参数
# colors.sh
#!/bin/bash
if [ -z $1 ]; then
BREAK=4
else
BREAK=$1
fi
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i} \t"
if [ $(( i % $BREAK )) -eq $(($BREAK-1)) ] ; then
printf "\n"
fi
done
Run Code Online (Sandbox Code Playgroud)
尝试将其保存到名为 colors.sh 的文件中,然后 ./colors.sh 4
别忘了chmod +x colors.sh
先。