Skip to content

Commit

Permalink
Merge pull request #307 from f3dm76/task/namedColors
Browse files Browse the repository at this point in the history
Fix #306: Named colors don't work in gradients
  • Loading branch information
ystrot authored Apr 11, 2018
2 parents 5003c54 + ac071be commit 2cec07b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/svg/SVGParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,12 @@ open class SVGParser {
}
var color = Color.black
if let stopColor = getStyleAttributes([:], element: element)["stop-color"] {
color = createColor(stopColor.replacingOccurrences(of: " ", with: ""), opacity: opacity)
if let defaultColor = SVGConstants.colorList[stopColor] {
color = Color(val: defaultColor).with(a: opacity)
} else {
color = createColor(stopColor.replacingOccurrences(of: " ", with: ""), opacity: opacity)
}

}

return Stop(offset: offset, color: color)
Expand Down

0 comments on commit 2cec07b

Please sign in to comment.