Skip to content

Instantly share code, notes, and snippets.

@eliranmal
Last active November 7, 2022 07:30
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eliranmal/b373abbe1c21e991b394bdffb0c8a6cf to your computer and use it in GitHub Desktop.
Save eliranmal/b373abbe1c21e991b394bdffb0c8a6cf 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