Skip to content

Instantly share code, notes, and snippets.

@iwill
Last active September 29, 2022 02:14
Show Gist options
  • Save iwill/c326ffab5bc005e4d54b to your computer and use it in GitHub Desktop.
Save iwill/c326ffab5bc005e4d54b to your computer and use it in GitHub Desktop.
color-legend.sh
#!/bin/bash
# http://ss64.com/bash/echo.html
echo -n -e " "
for j in {40..47}; do
echo -n -e " bj-$j "
# Reset text attributes to normal without clear
tput sgr0
done
echo
for i in {30..37}; do
echo -n -e "fg-$i"
for j in {40..47}; do
echo -n -e ' \x1b[00;'$i';'$j'mTEXT'
echo -n -e ' \x1b[01;'$i';'$j'mTEXT'
tput sgr0
done
echo
done
# fg-30/bg-40 black
# fg-31/bg-41 red
# fg-32/bg-42 green
# fg-33/bg-43 yellow
# fg-34/bg-44 blue
# fg-35/bg-45 magenta
# fg-36/bg-46 cyan
# fg-37/bg-47 white
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment