dotfiles/bin/gradient

38 lines
733 B
Bash
Executable file

#!/usr/bin/env bash
sleep 0.2 # let wezterm catch up
COLUMNS=$(tput cols)
line() {
i=1
while [[ $i -le $COLUMNS ]]; do
echo -en "\U1FB$((RANDOM % 3))$((RANDOM % 8 + 1))"
i=$((i + 1))
done
}
peoples() {
i=1
while [[ $i -le $COLUMNS ]]; do
echo -en "\U1FBC$((RANDOM % 5 +5))"
i=$((i + 1))
done
}
print-line() {
awk -v columns="$COLUMNS" -v s="$1" \
'BEGIN{
for (colnum = 0; colnum<columns+1; colnum++) {
r = 255-(colnum*255/columns);
g = (colnum*510/columns);
b = (colnum*255/columns);
if (g>255) g = 510-g;
printf "\033[38;2;%d;%d;%d;49;4m", r,g,b;
printf "%s\033[0m", substr(s,colnum+1,1);
}
printf "\n";
}'
}
echo
print-line "$(peoples)"