Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2023-07-28 11:48:50 +02:00
commit f76f4615cf
24 changed files with 177 additions and 56 deletions

View file

@ -7,6 +7,7 @@
(ns app.util.color
"Color conversion utils."
(:require
[app.common.data :as d]
[app.util.i18n :as i18n :refer [tr]]
[app.util.object :as obj]
[app.util.strings :as ust]
@ -150,6 +151,24 @@
:else "transparent")))
(defn color->format->background [{:keys [color opacity gradient]} format]
(let [opacity (or opacity 1)]
(cond
(and gradient (not= :multiple gradient))
(gradient->css gradient)
(not= color :multiple)
(case format
:rgba (let [[r g b] (hex->rgb color)]
(str/fmt "rgba(%s, %s, %s, %s)" r g b opacity))
:hsla (let [[h s l] (hex->hsl color)]
(str/fmt "hsla(%s, %s, %s, %s)" h (* 100 s) (* 100 l) opacity))
:hex (str color (str/upper (d/opacity-to-hex opacity))))
:else "transparent")))
(defn multiple? [{:keys [id file-id value color gradient]}]
(or (= value :multiple)
(= color :multiple)