fix color
This commit is contained in:
@@ -139,22 +139,24 @@ let
|
|||||||
return None, DEFAULT_PROFILE
|
return None, DEFAULT_PROFILE
|
||||||
|
|
||||||
def _replace_svg_color(svg, attribute, color):
|
def _replace_svg_color(svg, attribute, color):
|
||||||
if attribute in {"fill", "stroke"}:
|
if attribute not in {"fill", "stroke"}:
|
||||||
svg = re.sub(
|
return svg
|
||||||
rf'{attribute}="(?!none\\b)[^"]*"',
|
|
||||||
f'{attribute}="{color}"',
|
svg = re.sub(
|
||||||
svg,
|
rf'({attribute}\\s*=\\s*")(?!none\\b)[^"]*(")',
|
||||||
flags=re.IGNORECASE,
|
rf"\\1{color}\\2",
|
||||||
)
|
svg,
|
||||||
svg = re.sub(
|
flags=re.IGNORECASE,
|
||||||
rf"{attribute}='(?!none\\b)[^']*'",
|
)
|
||||||
f"{attribute}='{color}'",
|
svg = re.sub(
|
||||||
svg,
|
rf"({attribute}\\s*=\\s*')(?!none\\b)[^']*(')",
|
||||||
flags=re.IGNORECASE,
|
rf"\\1{color}\\2",
|
||||||
)
|
svg,
|
||||||
|
flags=re.IGNORECASE,
|
||||||
|
)
|
||||||
return re.sub(
|
return re.sub(
|
||||||
rf"{attribute}\\s*:\\s*(?!none\\b)[^;\"\\']+",
|
rf"({attribute}\\s*:\\s*)(?!none\\b)[^;\"']+",
|
||||||
f"{attribute}:{color}",
|
rf"\\1{color}",
|
||||||
svg,
|
svg,
|
||||||
flags=re.IGNORECASE,
|
flags=re.IGNORECASE,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user