Created
March 4, 2015 16:25
-
-
Save tylerkerr/77c29b99668c867a4a48 to your computer and use it in GitHub Desktop.
tests terminal color output via tput
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colortest() | |
{ | |
tput setaf 0 | |
echo -n "black " | |
tput setaf 7 | |
echo -n "white " | |
tput setaf 1 | |
echo -n "red " | |
tput setaf 2 | |
echo -n "green " | |
tput setaf 3 | |
echo -n "yellow " | |
tput setaf 4 | |
echo -n "blue " | |
tput setaf 5 | |
echo -n "magenta " | |
tput setaf 6 | |
echo -n "cyan " | |
tput setaf 153 | |
echo -n "powder " | |
tput setaf 190 | |
echo -n "lime " | |
tput setaf 7 | |
echo -n "white " | |
# bold now | |
tput sgr0 | |
echo "" | |
echo -n "bold" | |
tput bold | |
echo "" | |
tput setaf 0 | |
echo -n "black " | |
tput setaf 7 | |
echo -n "white " | |
tput setaf 1 | |
echo -n "red " | |
tput setaf 2 | |
echo -n "green " | |
tput setaf 3 | |
echo -n "yellow " | |
tput setaf 4 | |
echo -n "blue " | |
tput setaf 5 | |
echo -n "magenta " | |
tput setaf 6 | |
echo -n "cyan " | |
tput setaf 153 | |
echo -n "powder " | |
tput setaf 190 | |
echo -n "lime " | |
tput setaf 7 | |
echo -n "white " | |
#blink now | |
tput sgr0 | |
echo "" | |
tput blink | |
echo -n "blink" | |
echo "" | |
tput setaf 0 | |
echo -n "black " | |
tput setaf 7 | |
echo -n "white " | |
tput setaf 1 | |
echo -n "red " | |
tput setaf 2 | |
echo -n "green " | |
tput setaf 3 | |
echo -n "yellow " | |
tput setaf 4 | |
echo -n "blue " | |
tput setaf 5 | |
echo -n "magenta " | |
tput setaf 6 | |
echo -n "cyan " | |
tput setaf 153 | |
echo -n "powder " | |
tput setaf 190 | |
echo -n "lime " | |
tput setaf 7 | |
echo -n "white " | |
#reverse now | |
tput sgr0 | |
echo "" | |
tput smso | |
echo -n "reverse" | |
echo "" | |
tput setaf 0 | |
echo -n "black " | |
tput setaf 7 | |
echo -n "white " | |
tput setaf 1 | |
echo -n "red " | |
tput setaf 2 | |
echo -n "green " | |
tput setaf 3 | |
echo -n "yellow " | |
tput setaf 4 | |
echo -n "blue " | |
tput setaf 5 | |
echo -n "magenta " | |
tput setaf 6 | |
echo -n "cyan " | |
tput setaf 153 | |
echo -n "powder " | |
tput setaf 190 | |
echo -n "lime " | |
tput setaf 7 | |
echo -n "white " | |
# underline now | |
tput sgr0 | |
echo "" | |
tput smul | |
echo -n "underline" | |
echo "" | |
tput setaf 0 | |
echo -n "black " | |
tput setaf 7 | |
echo -n "white " | |
tput setaf 1 | |
echo -n "red " | |
tput setaf 2 | |
echo -n "green " | |
tput setaf 3 | |
echo -n "yellow " | |
tput setaf 4 | |
echo -n "blue " | |
tput setaf 5 | |
echo -n "magenta " | |
tput setaf 6 | |
echo -n "cyan " | |
tput setaf 153 | |
echo -n "powder " | |
tput setaf 190 | |
echo -n "lime " | |
tput setaf 7 | |
echo -n "white " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment