update gradient start
This commit is contained in:
parent
db6188d61d
commit
28e86dbd86
1 changed files with 18 additions and 19 deletions
17
bin/gradient
17
bin/gradient
|
@ -1,20 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ensure COLUMNS is set
|
||||
# stty size > /dev/null
|
||||
|
||||
COLUMNS=$(tput cols)
|
||||
# delay for wezterm to learn it's size
|
||||
sleep 0.2
|
||||
|
||||
line() {
|
||||
i=1
|
||||
while [[ $i -le $COLUMNS ]]; do
|
||||
echo -en "\u258$((RANDOM % 8 + 1))"
|
||||
echo -en "\U1FB$((RANDOM % 3))$((RANDOM % 8+1))"
|
||||
i=$((i + 1))
|
||||
done
|
||||
}
|
||||
echo
|
||||
|
||||
print-line() {
|
||||
awk -v columns="$COLUMNS" -v s="$(line)" \
|
||||
'BEGIN{
|
||||
for (colnum = 0; colnum<columns+1; colnum++) {
|
||||
|
@ -22,8 +17,12 @@ awk -v columns="$COLUMNS" -v s="$(line)" \
|
|||
g = (colnum*510/columns);
|
||||
b = (colnum*255/columns);
|
||||
if (g>255) g = 510-g;
|
||||
printf "\033[38;2;%d;%d;%dm", r,g,b;
|
||||
printf "\033[38;2;%d;%d;%d;49m", r,g,b;
|
||||
printf "%s\033[0m", substr(s,colnum+1,1);
|
||||
}
|
||||
printf "\n";
|
||||
}'
|
||||
}
|
||||
|
||||
print-line
|
||||
print-line
|
||||
|
|
Loading…
Reference in a new issue