You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
499 B
Bash

#!/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