0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Use tinycolor to convert hex color

This commit is contained in:
Florian Schroedl 2024-09-18 11:27:30 +02:00
parent e0e7b98ed7
commit b68e7af844
2 changed files with 7 additions and 5 deletions

View file

@ -71,9 +71,8 @@
:on-click on-click
:on-context-menu on-context-menu
:disabled errors?}
(js/console.log "resolved-value" resolved-value)
(when (wtt/color-token? token)
[:& color-bullet {:color (wtt/resolved-value-hex token)
(when-let [color (wtt/resolved-value-hex token)]
[:& color-bullet {:color color
:mini? true}])
name]))

View file

@ -2,7 +2,8 @@
(:require
[app.common.data :as d]
[clojure.set :as set]
[cuerdas.core :as str]))
[cuerdas.core :as str]
[app.main.ui.workspace.tokens.tinycolor :as tinycolor]))
(defn get-workspace-tokens
[state]
@ -199,4 +200,6 @@
(defn resolved-value-hex [{:keys [resolved-value] :as token}]
(when (and resolved-value (color-token? token))
(str "#" resolved-value)))
(some->> (tinycolor/valid-color resolved-value)
(tinycolor/->hex)
(str "#"))))