From d592a76bf1460538ecd97be0391168c3e1c1d740 Mon Sep 17 00:00:00 2001 From: Xavier Julian Date: Fri, 14 Nov 2025 12:00:02 +0100 Subject: [PATCH] :recycle: Add tests to ensure color space changes affect all properties --- .../src/app/main/ui/inspect/common/colors.cljs | 18 ++++++++++-------- .../styles/rows/color_properties_row.cljs | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/inspect/common/colors.cljs b/frontend/src/app/main/ui/inspect/common/colors.cljs index 6e7a9543c7..347f964ef3 100644 --- a/frontend/src/app/main/ui/inspect/common/colors.cljs +++ b/frontend/src/app/main/ui/inspect/common/colors.cljs @@ -29,11 +29,13 @@ (mf/deref library))) (defn color->color-space->css-format - [color opacity color-space] - (case color-space - "hex" color - "rgba" (let [[r g b a] (cc/hex->rgba color opacity)] - (dm/str "rgba(" (cc/format-rgba [r g b a]) ")")) - "hsla" (let [[h s l a] (cc/hex->hsla color opacity)] - (dm/str "hsla(" (cc/format-hsla [h s l a]) ")")) - (:color color))) + [color color-space] + (let [color-value (:color color) + color-opacity (or (:opacity color) 1)] + (case color-space + "hex" color + "rgba" (let [[r g b a] (cc/hex->rgba color-value color-opacity)] + (dm/str "rgba(" (cc/format-rgba [r g b a]) ")")) + "hsla" (let [[h s l a] (cc/hex->hsla color-value color-opacity)] + (dm/str "hsla(" (cc/format-hsla [h s l a]) ")")) + (:color color)))) diff --git a/frontend/src/app/main/ui/inspect/styles/rows/color_properties_row.cljs b/frontend/src/app/main/ui/inspect/styles/rows/color_properties_row.cljs index 64241192eb..3b8272c5e0 100644 --- a/frontend/src/app/main/ui/inspect/styles/rows/color_properties_row.cljs +++ b/frontend/src/app/main/ui/inspect/styles/rows/color_properties_row.cljs @@ -14,7 +14,6 @@ [app.main.ui.ds.buttons.button :refer [button*]] [app.main.ui.ds.tooltip :refer [tooltip*]] [app.main.ui.formats :as fmt] - [app.main.ui.inspect.common.colors :as isc] [app.main.ui.inspect.styles.property-detail-copiable :refer [property-detail-copiable*]] [app.util.color :as uc] [app.util.i18n :refer [tr]]