Skip to content

Instantly share code, notes, and snippets.

@janlay
Created April 9, 2020 04:06
Show Gist options
  • Save janlay/de6efb288042f521eb038243b9827bb9 to your computer and use it in GitHub Desktop.
Save janlay/de6efb288042f521eb038243b9827bb9 to your computer and use it in GitHub Desktop.
Full preview for tput foreground and background
#!/bin/bash
# author: janlay@gmail.com
set -e
cols=$(bc <<< "$(tput cols) / 3 - 2")
char=✾
echo -n ' '
for col in $(seq 0 $cols); do
printf '%3s' $col
done
echo
for f in {0..255}; do
printf '%3s' $f
f_color=$(tput setaf $f)
for b in $(seq 0 $cols); do
echo -n "$f_color$(tput setab $b) $char "
done
echo $(tput sgr0)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment