From 3b6a85c3b30d0cdb735e84e1809e5033b328d345 Mon Sep 17 00:00:00 2001 From: Bradley Date: Tue, 27 Jun 2023 09:36:32 +0100 Subject: [PATCH] Remove stroke current color --- src/Twig/Runtime/IconRuntime.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Twig/Runtime/IconRuntime.php b/src/Twig/Runtime/IconRuntime.php index 751f4dd..28430c5 100644 --- a/src/Twig/Runtime/IconRuntime.php +++ b/src/Twig/Runtime/IconRuntime.php @@ -87,6 +87,7 @@ final class IconRuntime implements RuntimeExtensionInterface $rawSvgMarkup = $this->getSvgMarkup($iconFilepath); $cleanSvgMarkup = $this->removeExistingTitleElement($rawSvgMarkup); $cleanSvgMarkup = $this->removeBlackStrokeAttributes($cleanSvgMarkup); + $cleanSvgMarkup = $this->removeStrokeCurrentColor($cleanSvgMarkup); return $this->removeBlackFillAttributes($cleanSvgMarkup); } @@ -119,6 +120,11 @@ final class IconRuntime implements RuntimeExtensionInterface return preg_replace('/stroke(=|:)"?\s*(#0{6}|#000|rgb\(\s*0,\s*0,\s*0\s*\)|black)\s*"?/', '', $content); } + private function removeStrokeCurrentColor(string $content): string + { + return \preg_replace('/stroke=(\'|")currentColor(\'|")/', '', $content); + } + private function removeBlackFillAttributes(string $content): string { return preg_replace('/fill(=|:)"?\s*(#0{6}|#000|rgb\(\s*0,\s*0,\s*0\s*\)|black)\s*"?/', '', $content);