diff --git a/Source/svg/SVGParser.swift b/Source/svg/SVGParser.swift index 522d9212..eb49c369 100644 --- a/Source/svg/SVGParser.swift +++ b/Source/svg/SVGParser.swift @@ -531,6 +531,7 @@ open class SVGParser { } fileprivate func createColor(_ hexString: String, opacity: Double = 1) -> Color { + let opacity = min(max(opacity, 0), 1) var cleanedHexString = hexString if hexString.hasPrefix("#") { cleanedHexString = hexString.replacingOccurrences(of: "#", with: "")