add gradient bars welcome script
This commit is contained in:
parent
82bc27b4da
commit
047480274b
2 changed files with 40 additions and 3 deletions
39
bin/gradient
Executable file
39
bin/gradient
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
echo ""
|
||||
COLUMNS=$(tput cols)
|
||||
|
||||
line() {
|
||||
i=1
|
||||
while [[ $i -le $COLUMNS ]]; do
|
||||
num=
|
||||
echo -en "\u258$(($RANDOM % 8 + 1))"
|
||||
i=$(($i + 1))
|
||||
done
|
||||
}
|
||||
|
||||
# print the text with gradient
|
||||
# awk -v columns=$COLUMNS -v s=$(line) \
|
||||
# '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[48;2;%d;%d;%dm", r,g,b;
|
||||
# printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
|
||||
# printf "%s\033[0m", substr(s,colnum+1,1);
|
||||
# }
|
||||
# printf "\n";
|
||||
# }'
|
||||
awk -v columns=$COLUMNS -v s=$(line) \
|
||||
'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;%dm", r,g,b;
|
||||
printf "%s\033[0m", substr(s,colnum+1,1);
|
||||
}
|
||||
printf "\n";
|
||||
}'
|
|
@ -34,6 +34,4 @@ unset EXTRAFILE
|
|||
export DOTFILES_DIR DOTFILES_EXTRA_DIR
|
||||
|
||||
# welcome art
|
||||
# clear
|
||||
! is-tty && [ -f ~/.welcome ] && cat ~/.welcome
|
||||
|
||||
! is-tty && $DOTFILES_DIR/bin/gradient
|
||||
|
|
Loading…
Reference in a new issue