From 0142acbc76d87ae552d52a70fb2dccc0167db9bd Mon Sep 17 00:00:00 2001 From: Invert_Ignas <148909431+IgnasFalcon@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:07:57 -0700 Subject: [PATCH] Added a rainbow screensaver script This script displays a colorful rainbow animation in the terminal. It has an option to list the rainbow instead of animating it using the command: rainbow -l. --- rainbow.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 rainbow.sh diff --git a/rainbow.sh b/rainbow.sh new file mode 100644 index 0000000..714298b --- /dev/null +++ b/rainbow.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +#Credit to IgnasFalcon for this script +#https://github.com/IgnasFalcon/Rainbow-Shell +#Usage: rainbow [-l] [CYCLES] + +clear + +#Define list option +list_mode=false + +while getopts "l" opt; do + case "$opt" in + l) list_mode=true ;; + *) exit 1 ;; + esac +done + +#This removes the -l +shift $((OPTIND - 1)) + +#Define colors +colors=( + "\e[31m" + "\e[38;5;208m" + "\e[33m" # Replacement for yellow + "\e[32m" + "\e[36m" + "\e[34m" # Closest to indigo + "\e[35m" +) + +#Rainbow function +rainbow() { + for c in "${colors[@]}"; do + if ! $list_mode; then + clear + fi + echo -e "${c}$(echo " +ooooooooo. .o. ooooo ooooo ooo oooooooooo. .oooooo. oooooo oooooo oooo +.888 .Y88. .888. .888. .888b. .8. .888. .Y8b d8P. .Y8b .888. .888. .8. + 888 .d88. .88888. 888 8 .88b. 8 888 888 888 888 .888. .8888. .8. + 888ooo88P. .8. .888. 888 8 .88b. 8 888oooo888. 888 888 .888 .8..888. .8. + 888.88b. .88ooo8888. 888 8 .88b.8 888 .88b 888 888 .888.8. .888.8. + 888 .88b. .8. .888. 888 8 .888 888 .88P .88b d88. .888. .888. +o888o o888o o88o o8888o o888o o8o .8 o888bood8P. .Y8bood8P. .8. .8.")\e[0m\r" + sleep 1 + done +} + +#Display rainbow +index=$(( $1 + 0 )) +if [[ $1 > "" ]]; then + while [[ $index > 0 ]]; do + rainbow + (( index-- )) + done +else + while true; do + rainbow + (( index-- )) + done +fi