add people to gradient

This commit is contained in:
Daylin Morgan 2022-09-08 17:41:19 -05:00
parent 0cf8885785
commit 20c7b6e823

View file

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