mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
🐛 Fix problem with shortcut colors and colorpicker
This commit is contained in:
parent
b8b40fc7ef
commit
512e9b2070
1 changed files with 8 additions and 3 deletions
|
@ -37,14 +37,19 @@
|
||||||
|
|
||||||
;; TODO: REMOVE `VALUE` WHEN COLOR IS INTEGRATED
|
;; TODO: REMOVE `VALUE` WHEN COLOR IS INTEGRATED
|
||||||
(defn color->background [{:keys [color opacity gradient value]}]
|
(defn color->background [{:keys [color opacity gradient value]}]
|
||||||
(let [color (or color value)
|
(let [color (d/nilv color value)
|
||||||
opacity (or opacity 1)]
|
opacity (or opacity 1)]
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
(and gradient (not= :multiple gradient))
|
(and gradient (not= :multiple gradient))
|
||||||
(gradient->css gradient)
|
(gradient->css gradient)
|
||||||
|
|
||||||
(not= color :multiple)
|
(and (some? color) (not= color :multiple))
|
||||||
(let [[r g b] (cc/hex->rgb (or color value))]
|
(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))
|
(str/fmt "rgba(%s, %s, %s, %s)" r g b opacity))
|
||||||
|
|
||||||
:else "transparent")))
|
:else "transparent")))
|
||||||
|
|
Loading…
Add table
Reference in a new issue