Remove stroke current color

This commit is contained in:
2023-06-27 09:36:32 +01:00
parent ac6a573ce2
commit 3b6a85c3b3

View File

@@ -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);