Skip to content

Instantly share code, notes, and snippets.

@yous
Created January 5, 2016 10:44
Show Gist options
  • Save yous/c303055cf65a99d65488 to your computer and use it in GitHub Desktop.
Save yous/c303055cf65a99d65488 to your computer and use it in GitHub Desktop.
Print 256 colors
#!/usr/bin/env bash
for i in {0..7}; do
next=$((${i} + 8))
printf "\x1b[38;5;${i}mcolour${i} \x1b[38;5;${next}mcolour${next}\n"
done
for i in {16..255}; do
printf "\x1b[38;5;${i}mcolour${i} "
if [[ $((${i} % 6)) == 3 ]]; then
printf "\n"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment