Created
October 13, 2011 21:23
-
-
Save exogen/1285572 to your computer and use it in GitHub Desktop.
Convert RGB values to hex and copy the result to the clipboard (Mac)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# rgb2hex -- Convert RGB values to hex and copy the result to the clipboard (Mac) | |
# usage: rgb2hex [r] [g] [b] | |
hex=$(python -c "print '#%02x%02x%02x' % (${1:-0}, ${2:-0}, ${3:-0})") | |
echo -n $hex | pbcopy | |
echo $hex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment