diff --git a/thebookofcolors b/thebookofcolors index 16cf489..13d7fb1 100755 --- a/thebookofcolors +++ b/thebookofcolors @@ -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