Skip to content

Instantly share code, notes, and snippets.

@sebastibe
Last active August 3, 2019 07:59
Show Gist options
  • Select an option

  • Save sebastibe/872df83ac328034fdbc4647700dbe756 to your computer and use it in GitHub Desktop.

Select an option

Save sebastibe/872df83ac328034fdbc4647700dbe756 to your computer and use it in GitHub Desktop.

Revisions

  1. sebastibe revised this gist Aug 3, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion colors.cljs
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,7 @@
    (->> (subs s 1 7)
    (partition 2)
    (map clojure.string/join)
    (mapv #(js/parseInt % 16))))
    (mapv #(js/parseInt % 16))))

    (defn hex->rgba [s opacity]
    (into [] (conj (hex->rgb s) opacity)))
  2. sebastibe created this gist Aug 3, 2019.
    6 changes: 6 additions & 0 deletions colors.cljs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    ;; 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))))