Skip to content

Instantly share code, notes, and snippets.

@sebastien
Forked from eliranmal/show-ansi-colors.sh
Created October 25, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastien/d1f1012a107d7a41cbfe528bd823114e to your computer and use it in GitHub Desktop.
Save sebastien/d1f1012a107d7a41cbfe528bd823114e to your computer and use it in GitHub Desktop.
spits N ansi colors to the terminal
#!/usr/bin/env sh
usage() {
echo "show-ansi-colors <n>"
exit 0
}
(( $# < 1 )) && usage
show_ansi_colors() {
local colors=$1
echo "showing $colors ansi colors:"
for (( n=0; n < $colors; n++ )) do
printf " [%d] $(tput setaf $n)%s$(tput sgr0)" $n "wMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMw
"
done
echo
}
show_ansi_colors "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment