Remove fill and stroke attributes where their value was black
This commit is contained in:
@@ -80,6 +80,8 @@ final class IconExtension extends AbstractExtension
|
||||
throw new \TypeError('Size value must be an integer');
|
||||
|
||||
$markup = $this->setSize($markup, $options['size']);
|
||||
$markup = $this->removeBlackStrokeAttributes($markup);
|
||||
$markup = $this->removeBlackFillAttributes($markup);
|
||||
|
||||
return $markup;
|
||||
}
|
||||
@@ -153,6 +155,16 @@ final class IconExtension extends AbstractExtension
|
||||
|
||||
return $xml;
|
||||
}
|
||||
|
||||
private function removeBlackStrokeAttributes(string $content): string
|
||||
{
|
||||
return preg_replace('/stroke="\s*(#0{6}|#000)|(rgb\(\s*0,\s*0,\s*0\s*\))|(black)\s*"/', '', $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);
|
||||
}
|
||||
}
|
||||
|
||||
class IconNotFound extends \Exception {};
|
||||
|
||||
Reference in New Issue
Block a user