Files
dot.config/bin/colortest
T
2026-09-13 00:28:36 +02:00

35 lines
954 B
Bash
Executable File

#!/bin/sh
# Show the 16 base terminal colors (regular0-7, bright0-7) as fg/bg swatches
# with sample text, for eyeballing a foot/terminal colorscheme.
names="black red green yellow blue magenta cyan white"
printf '\n\033[1mForeground on default background:\033[0m\n'
i=0
for n in $names; do
printf ' \033[3%sm%2d regular %-8s sample text AaBbCc\033[0m\n' "$i" "$i" "$n"
i=$((i + 1))
done
i=0
for n in $names; do
printf ' \033[9%sm%2d bright %-8s sample text AaBbCc\033[0m\n' "$i" "$((i + 8))" "$n"
i=$((i + 1))
done
printf '\n\033[1mBackground swatches (with contrasting text):\033[0m\n'
i=0
for n in $names; do
fg=15
[ "$i" = 3 ] && fg=0
[ "$i" = 7 ] && fg=0
printf ' \033[4%sm\033[38;5;%sm %2d regular %-8s \033[0m' "$i" "$fg" "$i" "$n"
i=$((i + 1))
done
printf '\n'
i=0
for n in $names; do
printf ' \033[10%sm\033[38;5;0m %2d bright %-8s \033[0m' "$i" "$((i + 8))" "$n"
i=$((i + 1))
done
printf '\n\n'