mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 03:41:38 +02:00
✨ Improve readability of RGBA and HSLA values in inspect mode (#5918)
* ✨ Improve readability of RGBA and HSLA values in inspect mode * 📎 Remove reader conditionals for format common methods
This commit is contained in:
parent
1c98c53805
commit
bcea19001e
5 changed files with 49 additions and 29 deletions
|
@ -129,13 +129,14 @@
|
|||
[:& cb/color-name {:color color :size 90}]
|
||||
(case format
|
||||
:hex [:& cb/color-name {:color color}]
|
||||
:rgba (let [[r g b a] (cc/hex->rgba (:color color) (:opacity color))]
|
||||
(str/ffmt "%, %, %, %" r g b a))
|
||||
:rgba (let [[r g b a] (cc/hex->rgba (:color color) (:opacity color))
|
||||
result (cc/format-rgba [r g b a])]
|
||||
[:* result])
|
||||
:hsla (let [[h s l a] (cc/hex->hsla (:color color) (:opacity color))
|
||||
result (cc/format-hsla [h s l a])]
|
||||
[:* result])))]
|
||||
|
||||
(when-not (:gradient color)
|
||||
(when (and (not (:gradient color)) (= :hex format))
|
||||
[:span {:class (stl/css :opacity-info)}
|
||||
(dm/str (-> color
|
||||
(:opacity)
|
||||
|
|
|
@ -63,10 +63,10 @@
|
|||
(not= color :multiple)
|
||||
(case format
|
||||
:rgba (let [[r g b] (cc/hex->rgb color)]
|
||||
(str/fmt "rgba(%s, %s, %s, %s)" r g b opacity))
|
||||
(str/fmt "rgba(%s)" (cc/format-rgba [r g b opacity])))
|
||||
|
||||
:hsla (let [[h s l] (cc/hex->hsl color)]
|
||||
(str/fmt "hsla(%s, %s, %s, %s)" h (* 100 s) (* 100 l) opacity))
|
||||
(str/fmt "hsla(%s)" (cc/format-hsla [h s l opacity])))
|
||||
|
||||
:hex (str color (str/upper (d/opacity-to-hex opacity))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue