Add random color generation for title
This commit is contained in:
parent
ca45bb719f
commit
ce2b0b9411
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue