Last active
August 3, 2019 07:59
-
-
Save sebastibe/872df83ac328034fdbc4647700dbe756 to your computer and use it in GitHub Desktop.
Some helpers when working with Colors in ClojureScript
This file contains hidden or 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
;; Hex to RBG (.i.e #63411E -> [99 65 30]) | |
(defn hex->rgb [s] | |
(->> (subs s 1 7) | |
(partition 2) | |
(map clojure.string/join) | |
(mapv #(js/parseInt % 16)))) | |
(defn hex->rgba [s opacity] | |
(into [] (conj (hex->rgb s) opacity))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment