]>
git.rmz.io Git - dotfiles.git/blob - bin/colortest256
2 # https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
3 # https://gist.github.com/XVilka/8346728#gistcomment-3528771
7 function echo_block
() {
11 for (( f
= 0; f
< 8; f
++ )); do
13 for (( b
= 0; b
< 8; b
++ )); do
14 echo -en "\033[38;5;$((fs+f))m\033[48;5;$((bs+b))m$T\033[0m";
20 function print_colors
() {
22 for (( c
= $1; c
< $1 + $2; c
++)); do
23 echo -en "\033[48;5;${c}m$T\033[0m"
30 for (( c
= 16; c
< 256 - 24; c
+= 36 )); do
33 print_colors
$((256 - 24)) 24
36 function true_colors
() {
37 awk -v term_cols
="${width:-$(tput cols || echo 80)}" 'BEGIN{
39 for (colnum = 0; colnum<term_cols; colnum++) {
40 r = 255-(colnum*255/term_cols);
41 g = (colnum*510/term_cols);
42 b = (colnum*255/term_cols);
44 printf "\033[48;2;%d;%d;%dm", r,g,b;
45 printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
46 printf "%s\033[0m", substr(s,colnum%2+1,1);