mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 22:22:43 -05:00
Use tinycolor to convert hex color
This commit is contained in:
parent
e0e7b98ed7
commit
b68e7af844
2 changed files with 7 additions and 5 deletions
|
@ -71,9 +71,8 @@
|
||||||
:on-click on-click
|
:on-click on-click
|
||||||
:on-context-menu on-context-menu
|
:on-context-menu on-context-menu
|
||||||
:disabled errors?}
|
:disabled errors?}
|
||||||
(js/console.log "resolved-value" resolved-value)
|
(when-let [color (wtt/resolved-value-hex token)]
|
||||||
(when (wtt/color-token? token)
|
[:& color-bullet {:color color
|
||||||
[:& color-bullet {:color (wtt/resolved-value-hex token)
|
|
||||||
:mini? true}])
|
:mini? true}])
|
||||||
name]))
|
name]))
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
[cuerdas.core :as str]))
|
[cuerdas.core :as str]
|
||||||
|
[app.main.ui.workspace.tokens.tinycolor :as tinycolor]))
|
||||||
|
|
||||||
(defn get-workspace-tokens
|
(defn get-workspace-tokens
|
||||||
[state]
|
[state]
|
||||||
|
@ -199,4 +200,6 @@
|
||||||
|
|
||||||
(defn resolved-value-hex [{:keys [resolved-value] :as token}]
|
(defn resolved-value-hex [{:keys [resolved-value] :as token}]
|
||||||
(when (and resolved-value (color-token? token))
|
(when (and resolved-value (color-token? token))
|
||||||
(str "#" resolved-value)))
|
(some->> (tinycolor/valid-color resolved-value)
|
||||||
|
(tinycolor/->hex)
|
||||||
|
(str "#"))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue