Skip to content

Instantly share code, notes, and snippets.

@cpedro
Created January 28, 2020 18:16
Show Gist options
  • Select an option

  • Save cpedro/7ee4a60fa6d8d0975b5185da0434fdf6 to your computer and use it in GitHub Desktop.

Select an option

Save cpedro/7ee4a60fa6d8d0975b5185da0434fdf6 to your computer and use it in GitHub Desktop.
Print out colours in a enabled terminal
#!/usr/bin/env bash
# Simple script to print out some colour codes to the terminal to show
# what's available. This can be expanded to included more codes easily
# by editing the for loops.
echo
echo "Prepend code with \\e["
for attr in {0..5} 7
do
for fgcl in {30..37}
do
for bgcl in "" {40..47}
do
[ "${bgcl}" != "" ] && bgcl=";$bgcl"
printf "\e[${attr};${fgcl}${bgcl}m${attr};${fgcl}${bgcl}m\e[0m "
done
echo
done
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment