Skip to content

Instantly share code, notes, and snippets.

@jorgehatccrma
Last active March 23, 2018 17:30
Show Gist options
  • Save jorgehatccrma/ee8e245b6f5e41d625c4b0e14d0c34c0 to your computer and use it in GitHub Desktop.
Save jorgehatccrma/ee8e245b6f5e41d625c4b0e14d0c34c0 to your computer and use it in GitHub Desktop.
Small bash script to print terminal color codes with bash
cumwidth=7
for i in {0..255}; do
printf "\x1b[38;5;${i}m [%03i] \x1b[0m" $i ;
if [ $i -eq $cumwidth ]; then
echo ;
if [ $cumwidth -ge 15 ]; then
((cumwidth+=6))
else
((cumwidth+=8))
fi ;
fi ;
done
@jorgehatccrma
Copy link
Author

jorgehatccrma commented Mar 23, 2018

On a dark (black) background it should look like this:

screen shot 2018-03-23 at 10 19 54 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment