Display ANSI colors

#!/bin/bash
# Display ANSI colors
clear
for attribute in 0 1 4 5 7 ; do
  printf "ESC[%s;Foreground;Background\n" $attribute 
  for foreground in 30 31 32 33 34 35 36 37; do
  for background in 40 41 42 43 44 45 46 47; do
  printf '\033[%s;%s;%sm %02s;%02s ' $attribute $foreground $background $foreground $background
  done
  printf '\n'
  done
  printf '\033[0m'
  echo "----------------------------------------------------------------"
done
#!/bin/bash

echo "Style: 0 = normal, 1 = fett, 4 = unterstrichen"

for style in 0 1 4; do
  echo -e "\n\033[1mStyle $style:\033[0m"
  for fg in {30..37} {90..97}; do
    for bg in {40..47} {100..107}; do
      code="\033[${style};${fg};${bg}m"
      reset="\033[0m"
      printf "${code} %3s;%3s;%3s ${reset} " "$style" "$fg" "$bg"
    done
    echo
  done
done

Siehe auch