mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 04:16:38 +02:00
🐛 Fix import svgs with currentColor as stroke fill
This commit is contained in:
parent
9c66998530
commit
be74cd2c7b
1 changed files with 13 additions and 11 deletions
|
@ -110,20 +110,22 @@
|
||||||
(get-in shape [:svg-attrs :style :stroke-linecap]))
|
(get-in shape [:svg-attrs :style :stroke-linecap]))
|
||||||
((d/nilf str/trim))
|
((d/nilf str/trim))
|
||||||
((d/nilf keyword)))
|
((d/nilf keyword)))
|
||||||
|
color-attr (str/trim (get-in shape [:svg-attrs :stroke]))
|
||||||
|
color-attr (if (= color-attr "currentColor") clr/black color-attr)
|
||||||
|
color-style (str/trim (get-in shape [:svg-attrs :style :stroke]))
|
||||||
|
color-style (if (= color-style "currentColor") clr/black color-style)
|
||||||
|
|
||||||
shape
|
shape
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
(uc/color? (str/trim (get-in shape [:svg-attrs :stroke])))
|
;; Color present as attribute
|
||||||
|
(uc/color? color-attr)
|
||||||
(-> (update :svg-attrs dissoc :stroke)
|
(-> (update :svg-attrs dissoc :stroke)
|
||||||
(assoc-in [:strokes 0 :stroke-color] (-> (get-in shape [:svg-attrs :stroke])
|
(assoc-in [:strokes 0 :stroke-color] (uc/parse-color color-attr)))
|
||||||
(str/trim)
|
|
||||||
(uc/parse-color))))
|
|
||||||
|
|
||||||
(uc/color? (str/trim (get-in shape [:svg-attrs :style :stroke])))
|
;; Color present as style
|
||||||
|
(uc/color? color-style)
|
||||||
(-> (update-in [:svg-attrs :style] dissoc :stroke)
|
(-> (update-in [:svg-attrs :style] dissoc :stroke)
|
||||||
(assoc-in [:strokes 0 :stroke-color] (-> (get-in shape [:svg-attrs :style :stroke])
|
(assoc-in [:strokes 0 :stroke-color] (uc/parse-color color-style)))
|
||||||
(str/trim)
|
|
||||||
(uc/parse-color))))
|
|
||||||
|
|
||||||
(get-in shape [:svg-attrs :stroke-opacity])
|
(get-in shape [:svg-attrs :stroke-opacity])
|
||||||
(-> (update :svg-attrs dissoc :stroke-opacity)
|
(-> (update :svg-attrs dissoc :stroke-opacity)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue