Skip to content

Instantly share code, notes, and snippets.

@michaelsanford
Last active November 21, 2019 23:38
Show Gist options
  • Save michaelsanford/8561202 to your computer and use it in GitHub Desktop.
Save michaelsanford/8561202 to your computer and use it in GitHub Desktop.
Bash colour code quick reference
#!/usr/bin/env bash
####
# Invoke with
# $ bash_colours [limit]
###
if hash tput >/dev/null 2>&1; then
bound=${1:-255}
for (( i = 0; i < bound; i++ )); do
echo -n "$(tput setaf $i)[$i]$(tput sgr0)"
done
else
echo "Requires tput"
exit 1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment