Skip to content

Instantly share code, notes, and snippets.

@jhallard
Created June 22, 2018 22:45
Show Gist options
  • Save jhallard/d77fca8164d2a24d5b4f66bd120cf525 to your computer and use it in GitHub Desktop.
Save jhallard/d77fca8164d2a24d5b4f66bd120cf525 to your computer and use it in GitHub Desktop.
Show an R,G,B color from the terminal using python and PIL
showcolor () {
if [ "$#" -lt 3 ]; then
echo "need to give 3 (r,g,b) values"
return 1
fi
python -c "from PIL import Image; Image.new('RGB', (300, 300), ($1, $2, $3)).show()"
}
# use like
# $ showcolor 125 125 200
# to open a 300x300 window with the color RGB(125, 125, 200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment