Created
June 10, 2013 13:02
-
-
Save vorce/5748534 to your computer and use it in GitHub Desktop.
hex-to-rgb
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
(defn hex-to-rgb | |
"Convert hex strings to rgb list. Ex: 'FF0000' -> (255 0 0)" | |
[hex] | |
(let [ hex-pairs (partition 2 hex) ] | |
(for [p hex-pairs] | |
(java.lang.Integer/parseInt (apply str p) 16)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment