Bash-tint aims to make your script's output nice and colorful, as easy as possible.
# Compare regular ANSI/VT100 Control sequences
echo -e "e[97m\e[46mT\e[49m\e[45mI\e[49m\e[43mN\e[49m\e[40mT\e[49m\e[39m is fun!"
# To the simplicity of tint:
tint "white(Cyan(T)Magenta(I)Yellow(N)Black(T)) is fun!"
It is more readable than the regular ANSI/VT100 Control sequences:
# Can you guess what will this output?
^[[97m^[[41mR^[[49m^[[43mA^[[49m^[[103mI^[[49m^[[42mN^[[49m^[[104mB^[[49m^[[44mO^[[49m^[[45mW^[[49m^[[39m$
# How about this?
tint "white(Red(R)Yellow(A)Light_yellow(I)Green(N)Light_blue(B)Blue(O)Magenta(W))"
It also comes with tintf
, the colorful sister of printf
:
tintf "Running test: bold(%s) %s" "Test XYZ" "green([OK])"
git clone https://github.com/ArtBIT/bash-tint.git
source path/to/bash-tint/src/tint
Using bash-clam
clamx ArtBIT/bash-tint --source src/tint
tint "white(Cyan(T)Magenta(I)Yellow(N)Black(T)) is bold(really) easy to use."
tintf "Running test: bold(%s) %s" "Test XYZ" "green([OK])"
tintf "bold(%s) %s" "red([Error:])" "Could not load config file."
for (( i=0; i<=$(tput colors); i++ )); do tintf "Color($i)( )"; done;
http://wiki.bash-hackers.org/scripting/terminalcodes (Thanks to sdk- for pointing me in the right direction)