Skip to content

Instantly share code, notes, and snippets.

@projectivemotion
Created May 10, 2016 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save projectivemotion/41d7d463180b0fd03158e84cd8975ce0 to your computer and use it in GitHub Desktop.
Save projectivemotion/41d7d463180b0fd03158e84cd8975ce0 to your computer and use it in GitHub Desktop.
Flash Terminal Color, Blink Terminal Colors
#!/bin/bash
#
# Author: Amado Martinez - AmadoMartinez.mx
# License: MIT License
# Date: 2016-05-10
#
# Keywords: Flash Terminal Color Shell Color Blink Alert
#
if [ $# -lt 2 ] ; then
head -n 10 $0 | grep ^#
echo -e "Usage:\n\t$0 [speed] [times] [color1] [color2]\nExample:\n\t$0 0.5 3 red white\n"
exit
fi
if [ $# -lt 4 ] ; then
fore=black
back=white
else
fore=$3
back=$4
fi
function flip(){
setterm -term linux -back $1 -fore $2 -clear all
}
for i in $(seq 1 $2); do
flip $back $fore
sleep $1
flip $fore $back
sleep $1
done
setterm -default -clear all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment