Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Source/Parser/SVG/SVGIndex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,16 @@ class SVGIndex {
private func parseStop(_ element: XMLElement, _ style: [String: String]) -> SVGStop? {
let offset = getDoubleValueFromPercentage(element, attribute: "offset")

// Explode any CSS styles and merge with XML style attributes
let cssAttributes = SVGParser.getStyleAttributes(xml: element, index: self)
let attributes = element.attributes.merging(cssAttributes) { current, _ in current }

var opacity: Double = 1
if let stopOpacity = element.attributes["stop-opacity"], let doubleValue = Double(stopOpacity) {
if let stopOpacity = attributes["stop-opacity"], let doubleValue = Double(stopOpacity) {
opacity = doubleValue
}
var color = SVGColor.black.opacity(opacity)
if let stopColor = element.attributes["stop-color"], let clr = SVGHelper.parseColor(stopColor, style) {
if let stopColor = attributes["stop-color"], let clr = SVGHelper.parseColor(stopColor, style) {
color = clr.opacity(opacity)
}
return SVGStop(color: color, offset: offset)
Expand Down