Skip to content

Instantly share code, notes, and snippets.

@crides
Created January 2, 2022 22:54
Show Gist options
  • Save crides/7998700daca42444d47afa8e032bf8a1 to your computer and use it in GitHub Desktop.
Save crides/7998700daca42444d47afa8e032bf8a1 to your computer and use it in GitHub Desktop.
Bash script to output the color in Gruvbox theme. Uses sharkdp/pastel
#!/usr/bin/bash
usage() {
echo "gruvbox ( light | dark ) <COLOR>"
exit 1
}
color() {
case "$1" in
red) c="cc241d";;
green) c="98971a";;
yellow) c="d79921";;
blue) c="458588";;
purple) c="b16286";;
aqua) c="689d9a";;
orange) c="d65d0e";;
dark-red) c="9d0006";;
dark-green) c="79740e";;
dark-yellow) c="b57614";;
dark-blue) c="076678";;
dark-purple) c="8f3f71";;
dark-aqua) c="427b58";;
dark-orange) c="af3a03";;
light-red) c="fb4934";;
light-green) c="b8bb26";;
light-yellow) c="fabd2f";;
light-blue) c="83a598";;
light-purple) c="d3869b";;
light-aqua) c="8ec07c";;
light-orange) c="fe8019";;
esac
echo "$c"
}
gray=("282828"
"3c3836"
"504945"
"665c54"
"7c6f64"
"928374"
"a89984"
"bdae93"
"d5c4a1"
"ebdbb2"
"fbf1c7")
case "$1" in
dark)
case "$2" in
red|dark-red) c=$(color red);;
green|dark-green) c=$(color green);;
yellow|dark-yellow) c=$(color yellow);;
blue|dark-blue) c=$(color blue);;
purple|dark-purple) c=$(color purple);;
aqua|dark-aqua) c=$(color aqua);;
orange|dark-orange) c=$(color orange);;
light-red) c=$(color light-red);;
light-green) c=$(color light-green);;
light-yellow) c=$(color light-yellow);;
light-blue) c=$(color light-blue);;
light-purple) c=$(color light-purple);;
light-aqua) c=$(color light-aqua);;
light-orange) c=$(color light-orange);;
bg-h) c="1d2021";;
bg-s) c="32302f";;
bg0|bg) c=${gray[0]};;
bg1) c=${gray[1]};;
bg2) c=${gray[2]};;
bg3) c=${gray[3]};;
bg4) c=${gray[4]};;
gray|dark-gray) c=${gray[5]};;
fg4|light-gray) c=${gray[6]};;
fg3) c=${gray[7]};;
fg2) c=${gray[8]};;
fg1|fg) c=${gray[9]};;
fg0) c=${gray[10]};;
*) echo "Invalid color"; usage ;;
esac
pastel color "$c"
;;
light)
case "$2" in
red|light-red) c=$(color red);;
green|light-green) c=$(color green);;
yellow|light-yellow) c=$(color yellow);;
blue|light-blue) c=$(color blue);;
purple|light-purple) c=$(color purple);;
aqua|light-aqua) c=$(color aqua);;
orange|light-orange) c=$(color orange);;
dark-red) c=$(color light-red);;
dark-green) c=$(color light-green);;
dark-yellow) c=$(color light-yellow);;
dark-blue) c=$(color light-blue);;
dark-purple) c=$(color light-purple);;
dark-aqua) c=$(color light-aqua);;
dark-orange) c=$(color light-orange);;
bg-h) c="f9f5d7";;
bg-s) c="f2e5bc";;
bg0|bg) c=${gray[10]};;
bg1) c=${gray[9]};;
bg2) c=${gray[8]};;
bg3) c=${gray[7]};;
bg4|dark-gray) c=${gray[6]};;
gray|light-gray) c=${gray[5]};;
fg4) c=${gray[4]};;
fg3) c=${gray[3]};;
fg2) c=${gray[2]};;
fg1|fg) c=${gray[1]};;
fg0) c=${gray[0]};;
*) echo "Invalid color"; usage ;;
esac
pastel color "$c"
;;
*) echo "Invalid theme"; usage ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment