0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 00:40:30 -05:00

🐛 Fix problem with shortcut colors and colorpicker

This commit is contained in:
alonso.torres 2024-02-05 14:41:59 +01:00 committed by Andrey Antukh
parent b8b40fc7ef
commit 512e9b2070

View file

@ -37,14 +37,19 @@
;; TODO: REMOVE `VALUE` WHEN COLOR IS INTEGRATED
(defn color->background [{:keys [color opacity gradient value]}]
(let [color (or color value)
(let [color (d/nilv color value)
opacity (or opacity 1)]
(cond
(and gradient (not= :multiple gradient))
(gradient->css gradient)
(not= color :multiple)
(let [[r g b] (cc/hex->rgb (or color value))]
(and (some? color) (not= color :multiple))
(let [color
(-> (str/replace color "#" "")
(cc/expand-hex)
(cc/prepend-hash))
[r g b] (cc/hex->rgb color)]
(str/fmt "rgba(%s, %s, %s, %s)" r g b opacity))
:else "transparent")))