Merge pull request #2816 from penpot/eva-bugfix-2

Eva polishing
This commit is contained in:
Alejandro 2023-01-20 15:50:59 +01:00 committed by GitHub
commit 50eee3f597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 13 deletions

View file

@ -8,6 +8,7 @@
"Color conversion utils."
(:require
[app.util.object :as obj]
[app.util.strings :as ust]
[cuerdas.core :as str]
[goog.color :as gcolor]))
@ -55,6 +56,14 @@
(-> (hex->hsl data)
(conj opacity)))
(defn format-hsla
[[h s l a]]
(let [precision 2
rounded-s (* 100 (ust/format-precision s precision))
rounded-l (* 100 (ust/format-precision l precision))]
(str/fmt "%s, %s%, %s%, %s" h rounded-s rounded-l a)))
(defn hsl->rgb
[[h s l]]
(gcolor/hslToRgb h s l))
@ -116,9 +125,9 @@
stops-css (str/join "," (map parse-stop stops))]
(if (= type :linear)
(str/fmt "linear-gradient(to bottom, %s)" stops-css)
(str/fmt "radial-gradient(circle, %s)" stops-css))))
(if (= type :linear)
(str/fmt "linear-gradient(to bottom, %s)" stops-css)
(str/fmt "radial-gradient(circle, %s)" stops-css))))
;; TODO: REMOVE `VALUE` WHEN COLOR IS INTEGRATED
(defn color->background [{:keys [color opacity gradient value]}]