Created
October 23, 2013 06:11
-
-
Save pixline/7113327 to your computer and use it in GitHub Desktop.
color bash techniques
This file contains hidden or 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
# Text color variables | |
txtred='\e[0;31m' # red | |
txtgrn='\e[0;32m' # green | |
txtylw='\e[0;33m' # yellow | |
txtblu='\e[0;34m' # blue | |
txtpur='\e[0;35m' # purple | |
txtcyn='\e[0;36m' # cyan | |
txtwht='\e[0;37m' # white | |
bldred='\e[1;31m' # red - Bold | |
bldgrn='\e[1;32m' # green | |
bldylw='\e[1;33m' # yellow | |
bldblu='\e[1;34m' # blue | |
bldpur='\e[1;35m' # purple | |
bldcyn='\e[1;36m' # cyan | |
bldwht='\e[1;37m' # white | |
txtund=$(tput sgr 0 1) # Underline | |
txtbld=$(tput bold) # Bold | |
txtrst='\e[0m' # Text reset | |
# Feedback indicators | |
info="\n${bldblu} - ${txtrst}\n" | |
pass="${bldgrn} * ${txtrst}" | |
warn="${bldylw} ! ${txtrst}" | |
dead="${bldred}!!!${txtrst}" |
This file contains hidden or 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
#!/bin/bash | |
# tputcolors | |
echo | |
echo -e "$(tput bold) reg bld und tput-command-colors$(tput sgr0)" | |
for i in $(seq 1 7); do | |
echo " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)" | |
done | |
echo ' Bold $(tput bold)' | |
echo ' Underline $(tput sgr 0 1)' | |
echo ' Reset $(tput sgr0)' | |
echo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment