Skip to content

Commit

Permalink
Fix #306: Named colors don't work in gradients
Browse files Browse the repository at this point in the history
  • Loading branch information
f3dm76 committed Apr 10, 2018
1 parent 5003c54 commit ac071be
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 ac071be

Please sign in to comment.