Add random color generation for title

This commit is contained in:
The Magician 2023-11-07 15:57:30 +00:00
parent ca45bb719f
commit ce2b0b9411
1 changed files with 16 additions and 1 deletions

View File

@ -2,8 +2,23 @@
set -e
random_channel_strength() {
shuf -i 0-255 -n 1
}
random_rgb_color_pair() {
red="$(random_channel_strength)"
green="$(random_channel_strength)"
blue="$(random_channel_strength)"
printf "$red;$green;$blue|$((255 - $red));$((255 - green));$((255 - blue))"
}
thebookofcolors() {
printf "\e[4;7;36m"
colors=$(random_rgb_color_pair)
foreground="$(echo $colors | cut -d '|' -f 1)"
background="$(echo $colors | cut -d '|' -f 2)"
printf "\e[38;2;${foreground}m"
printf "\e[48;2;${background}m"
if test -z "$1"; then
printf "The Book of Colors"
else