♻️ Add tests to ensure color space changes affect all properties

This commit is contained in:
Xavier Julian 2025-11-14 12:00:02 +01:00
parent 53eeb76d4c
commit d592a76bf1
2 changed files with 10 additions and 9 deletions

View File

@ -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))))

View File

@ -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]]