How does the tmux color palette work?
You can get a list with this bash
snippet:
for i in {0..255}; do
printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n"
done
Then use colourxxx
with tmux
.
I found this image to be enlightening.
In Subversion (what will be tmux 1.5) you can also use #abcdef hex-style colours which are mapped to the nearest 256 colour palette entry. You need quotes as it's treated as a string, whereas regular color names are treated as named constants. Also note that 3-letter shorthand (#f00) is invalid.
Example:
set pane-active-border-bg red # no quotes for name
set pane-active-border-bg "#ff0000" # quotes for rgb
Before tmux 3.2 (released in April 2021), tmux only supported the international (British) spelling for the 256 colour palette, e.g.
"colour121"
as opposed to the American spelling that drops the u
"color121"
If you're using tmux 3.2 or later, you can spell it either way.
Building up on @cYrus' answer, I wrote a script to break the output of the colors into N number of columns, where N is the first argument
# 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
Try it by saving it into a file called colors.sh, then ./colors.sh 4
Don't forget to chmod +x colors.sh
first.