dotfiles/bin/gradient

39 lines
732 B
Text
Raw Permalink Normal View History

2022-08-26 18:46:11 -05:00
#!/usr/bin/env bash
2022-09-08 17:41:19 -05:00
2022-09-06 23:22:38 -05:00
sleep 0.2 # let wezterm catch up
2022-09-02 15:57:52 -05:00
COLUMNS=$(tput cols)
2022-08-26 18:46:11 -05:00
line() {
2022-09-07 09:16:25 -05:00
i=1
while [[ $i -le $COLUMNS ]]; do
echo -en "\U1FB$((RANDOM % 3))$((RANDOM % 8 + 1))"
i=$((i + 1))
done
2022-08-26 18:46:11 -05:00
}
2022-09-06 23:22:38 -05:00
2022-09-08 17:41:19 -05:00
peoples() {
i=1
while [[ $i -le $COLUMNS ]]; do
2022-09-09 12:09:38 -05:00
echo -en "\U1FBC$((RANDOM % 5 + 5))"
2022-09-08 17:41:19 -05:00
i=$((i + 1))
done
}
2022-09-06 23:22:38 -05:00
print-line() {
2022-09-08 17:41:19 -05:00
awk -v columns="$COLUMNS" -v s="$1" \
2022-09-07 09:16:25 -05:00
'BEGIN{
2022-09-06 23:22:38 -05:00
for (colnum = 0; colnum<columns+1; colnum++) {
2022-08-26 18:46:11 -05:00
r = 255-(colnum*255/columns);
g = (colnum*510/columns);
b = (colnum*255/columns);
if (g>255) g = 510-g;
2022-09-08 17:41:19 -05:00
printf "\033[38;2;%d;%d;%d;49;4m", r,g,b;
2022-08-26 18:46:11 -05:00
printf "%s\033[0m", substr(s,colnum+1,1);
2022-09-06 23:22:38 -05:00
}
printf "\n";
}'
}
2022-09-08 17:41:19 -05:00
echo
print-line "$(peoples)"