Skip to content

Instantly share code, notes, and snippets.

@johnelliott
Last active December 1, 2018 03:52
Show Gist options
  • Select an option

  • Save johnelliott/c8fb215a7831356a14cc to your computer and use it in GitHub Desktop.

Select an option

Save johnelliott/c8fb215a7831356a14cc to your computer and use it in GitHub Desktop.
terminal colors test
#!/bin/bash
# tput_colors - Demonstrate color combinations. http://linuxcommand.org/lc3_adv_tput.php
for fg_color in {0..7}; do
set_foreground=$(tput setaf $fg_color)
for bg_color in {0..7}; do
set_background=$(tput setab $bg_color)
echo -n $set_background$set_foreground
printf ' F:%02s B:%02s ' $fg_color $bg_color
done
echo $(tput sgr0)
done
echo
for fg_color in {8..15}; do
set_foreground=$(tput setaf $fg_color)
for bg_color in {8..15}; do
set_background=$(tput setab $bg_color)
echo -n $set_background$set_foreground
printf ' F:%02s B:%02s ' $fg_color $bg_color
done
echo $(tput sgr0)
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment