rwxrob-dot/scripts/sunrise
Rob Muhlestein 2ea0289e9f Rebase
2022-02-09 02:29:05 -05:00

27 lines
499 B
Bash
Executable File

#!/usr/bin/env bash
p=3.14
i=0
reset () {
/usr/bin/reset
printf "\033[H\033[2J\033[0m"
exit
}
trap "setterm --cursor on; stty echo; echo ${clear}; exit; trap -- - SIGINT SIGTERM" SIGTERM SIGINT
trap reset EXIT
trap reset SIGINT
stty -echo
setterm --cursor off
while true; do
i=$(bc -l <<< "$i+0.04")
r=$(bc -l <<< "128+127*s($i)")
g=$(bc -l <<< "128+127*s($i+$p*(1/3))")
b=$(bc -l <<< "128+127*s($i+$p*(2/3))")
printf "\033[48;2;${r%%.*};${g%%.*};${b%%.*}m\n"
sleep .01
done