random.sh Random
This script fills your terminal with colors...
wget https://git.christianimmanuel.de/scripts/raw/Random/random.sh && chmod 740 random.shrandom.sh raw
#!/bin/bash
#################################################
### This script fills your terminal with colors...
COLS="$(($(tput cols)+1))"
ROWS="$(($(tput lines)+1))"
TOTAL="$((COLS*ROWS))"
ALL_COLORS=(40 41 42 43 44 45 46 47 48)
COLORS=()
getColors() {
for ((i=0;i<${#ALL_COLORS[*]};i++)); do
r="$(( $RANDOM % ${#ALL_COLORS[*]} + 0 ))"
COLORS+=("${ALL_COLORS[$r]}")
done
}
getColors
setColors() {
r="$(( $RANDOM % ${#ALL_COLORS[*]} + 1 ))"
COLORS=("${COLORS[@]:1}")
COLORS+=("${ALL_COLORS[$r]}")
}
printCol() {
ROW=$1
COL=$2
printf "\e[1;97;$COLOR\e[$[ROW];$[COL]f \e[0m"
}
printColCheck() {
if [[ "$ra" -gt "0" ]] && [[ "$ca" -gt "0" ]] && [[ "$ra" -le "$ROWS" ]] && [[ "$ca" -le "$COLS" ]] && [[ "$rb" -gt "0" ]] && [[ "$cb" -gt "0" ]] && [[ "$rb" -le "$ROWS" ]] && [[ "$cb" -le "$COLS" ]]; then
[[ "$ra" -gt "0" ]] && [[ "$ca" -gt "0" ]] && [[ "$ra" -le "$ROWS" ]] && [[ "$ca" -le "$COLS" ]] && printCol $ra $ca
[[ "$ra" -gt "0" ]] && [[ "$cb" -gt "0" ]] && [[ "$ra" -le "$ROWS" ]] && [[ "$cb" -le "$COLS" ]] && printCol $ra $cb
[[ "$rb" -gt "0" ]] && [[ "$ca" -gt "0" ]] && [[ "$rb" -le "$ROWS" ]] && [[ "$ca" -le "$COLS" ]] && printCol $rb $ca
[[ "$rb" -gt "0" ]] && [[ "$cb" -gt "0" ]] && [[ "$rb" -le "$ROWS" ]] && [[ "$cb" -le "$COLS" ]] && printCol $rb $cb
fi
}
row=0
col=0
setRanColor() {
colorrandom="$(( $RANDOM % ${#COLORS[*]} + 0 ))"
echo "${COLORS[$colorrandom]}m"
}
centerPoints() {
row=$((ROWS/2+1))
col=$((COLS/2+1))
for ((i=0; i<$row; i++)); do
ra=$(($i+$row))
rb=$(($row-$i))
for ((n=0; n<$col; n++)); do
ca=$(($n+$col))
cb=$(($col-$n))
COLOR="$(setRanColor)"
printColCheck
done
done
}
circlePoints() {
circle="$(( $RANDOM % $(($(tput cols)/3)) + 0 ))"
row="$(( $RANDOM % ROWS + 1 ))"
col="$(( $RANDOM % COLS + 1 ))"
for ((i=0; i<$circle; i++)); do
ra=$(($i+$row))
rb=$(($row-$i))
for ((n=0; n<$circle; n++)); do
ca=$(($n+$col))
cb=$(($col-$n))
COLOR="$(setRanColor)"
printColCheck
done
done
}
randomPoints() {
total="$(( $RANDOM % TOTAL + 1 ))"
for ((i=0;i<$total;i++)); do
row="$(( $RANDOM % ROWS + 1 ))"
col="$(( $RANDOM % COLS + 1 ))"
COLOR="$(setRanColor)"
printCol $row $col
done
}
OPTIONS=(randomPoints circlePoints centerPoints)
c=0
while true; do
setColors
c="$((c+1))"
l=$((${#OPTIONS[*]}))
r="$(( $RANDOM % l + 0 ))"
${OPTIONS[$r]}
sleep 0.1
done