256-colour test pattern
To get the below image, use:
curl -s https://gist.githubusercontent.com/HaleTom/89ffe32783f89f403bba96bd7bcd1263/raw/e50a28ec54188d2413518788de6c6367ffcea4f7/print256colours.sh | bash
The gist bash
/zsh
code is shellcheck
clean, and also supports "Look Ma, no subprocesses!".
Alternatively, for a bash
quicky:
for i in {0..255} ; do
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
printf "\n";
fi
done
For total overkill, the granddaddy of the lot is terminal-colors
, a 572-line script with multiple output formats.
You can also print a true color (24-bit) test pattern.