Skip to content

Instantly share code, notes, and snippets.

@jamesliu96
Last active August 29, 2015 13:58
Show Gist options
  • Save jamesliu96/9927721 to your computer and use it in GitHub Desktop.
Save jamesliu96/9927721 to your computer and use it in GitHub Desktop.
Shell color test
#!/bin/sh
# use `printf "\033[{{STYLE}};{{FOREGROUND_COLOR}};{{BACKGROUND_COLOR}}m"` to set the color of all the output from the shell
# use `printf "\033[0m"` to reset
for attr in 0 1 4 5 7 ; do
echo "----------------------------------------------------------------"
printf "ESC[%s;Foreground;Background - \n" $attr
for fore in 30 31 32 33 34 35 36 37; do
for back in 40 41 42 43 44 45 46 47; do
printf '\033[%s;%s;%sm %02s;%02s ' $attr $fore $back $fore $back
done
printf '\n'
done
printf '\033[0m'
done
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment