From 512e9b2070b3dfea190cfaf2b99d105e397ebf34 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 5 Feb 2024 14:41:59 +0100 Subject: [PATCH] :bug: Fix problem with shortcut colors and colorpicker --- frontend/src/app/util/color.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/util/color.cljs b/frontend/src/app/util/color.cljs index 79989b389..aeb95d007 100644 --- a/frontend/src/app/util/color.cljs +++ b/frontend/src/app/util/color.cljs @@ -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")))