Created
August 15, 2016 13:06
-
-
Save illarionov/a8cd1b50d74ac0ef20bf10d8b2913fb9 to your computer and use it in GitHub Desktop.
UIColor(red:0.643, green:0.549, blue:0.839, alpha: 1) -> ffa48cd6
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/sh | |
#Usage: echo 'UIColor(red:0.643, green:0.549, blue:0.839, alpha: 1)' | uicolor2argb | |
perl -nle 'if (/UIColor\(red\:\s*(\S+)\,\s*green:\s*(\S+)\,\s*blue:\s*(\S+),\s*alpha:\s*(\S)/) { printf "%02x%02x%02x%02x\n", 0.5+255*$4, 0.5 + 255 * $1, 0.5+255*$2, 0.5+255*$3}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment