mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🐛 Fix "currentColor" is not converted when importing SVG
This commit is contained in:
parent
ebfe651b7d
commit
0b2ffbe1fa
2 changed files with 25 additions and 23 deletions
|
@ -33,6 +33,7 @@
|
|||
- Fix missing loading icon on shared libraries [Taiga #4148](https://tree.taiga.io/project/penpot/issue/4148)
|
||||
- Fix selection stroke missing in properties of multiple texts [Taiga #4048](https://tree.taiga.io/project/penpot/issue/4048)
|
||||
- Fix missing create component menu for frames [Github #2670](https://github.com/penpot/penpot/issues/2670)
|
||||
- Fix "currentColor" is not converted when importing SVG [Github 2276](https://github.com/penpot/penpot/issues/2276)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.main.data.workspace.svg-upload
|
||||
(:require
|
||||
[app.common.colors :as clr]
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.matrix :as gmt]
|
||||
[app.common.geom.point :as gpt]
|
||||
|
@ -73,22 +74,22 @@
|
|||
:else (str tag))))
|
||||
|
||||
(defn setup-fill [shape]
|
||||
(let [color-attr (str/trim (get-in shape [:svg-attrs :fill]))
|
||||
color-attr (if (= color-attr "currentColor") clr/black color-attr)
|
||||
color-style (str/trim (get-in shape [:svg-attrs :style :fill]))
|
||||
color-style (if (= color-style "currentColor") clr/black color-style)]
|
||||
(cond-> shape
|
||||
;; Color present as attribute
|
||||
(uc/color? (str/trim (get-in shape [:svg-attrs :fill])))
|
||||
(uc/color? color-attr)
|
||||
(-> (update :svg-attrs dissoc :fill)
|
||||
(update-in [:svg-attrs :style] dissoc :fill)
|
||||
(assoc-in [:fills 0 :fill-color] (-> (get-in shape [:svg-attrs :fill])
|
||||
(str/trim)
|
||||
(uc/parse-color))))
|
||||
(assoc-in [:fills 0 :fill-color] (uc/parse-color color-attr)))
|
||||
|
||||
;; Color present as style
|
||||
(uc/color? (str/trim (get-in shape [:svg-attrs :style :fill])))
|
||||
(uc/color? color-style)
|
||||
(-> (update-in [:svg-attrs :style] dissoc :fill)
|
||||
(update :svg-attrs dissoc :fill)
|
||||
(assoc-in [:fills 0 :fill-color] (-> (get-in shape [:svg-attrs :style :fill])
|
||||
(str/trim)
|
||||
(uc/parse-color))))
|
||||
(assoc-in [:fills 0 :fill-color] (uc/parse-color color-style)))
|
||||
|
||||
(get-in shape [:svg-attrs :fill-opacity])
|
||||
(-> (update :svg-attrs dissoc :fill-opacity)
|
||||
|
@ -100,7 +101,7 @@
|
|||
(-> (update-in [:svg-attrs :style] dissoc :fill-opacity)
|
||||
(update :svg-attrs dissoc :fill-opacity)
|
||||
(assoc-in [:fills 0 :fill-opacity] (-> (get-in shape [:svg-attrs :style :fill-opacity])
|
||||
(d/parse-double))))))
|
||||
(d/parse-double)))))))
|
||||
|
||||
(defn setup-stroke [shape]
|
||||
(let [stroke-linecap (-> (or (get-in shape [:svg-attrs :stroke-linecap])
|
||||
|
|
Loading…
Reference in a new issue