another small fix in replace color and alpha

This commit is contained in:
Mario Voigt 2023-01-20 12:44:30 +01:00
parent 380fc41cf6
commit d292a69d5f

View File

@ -52,8 +52,17 @@ class ReplaceColorAndAlpha(inkex.EffectExtension):
except Exception as e: except Exception as e:
inkex.utils.debug(e) inkex.utils.debug(e)
pass pass
elements = []
if self.svg.selected:
for id, node in self.svg.selected.items():
elements.append(node)
else:
svg = self.document.getroot() svg = self.document.getroot()
for element in svg.iter("*"): for svg_element in svg.iter("*"):
elements.append(svg_element)
for element in elements:
style = element.get('style') style = element.get('style')
if style: if style:
if (style.lower().find('fill:#'+fr[:6]) != -1 and len(fr) == 6) or (style.lower().find('fill-opacity:'+alphaFr[:4]) != -1 and len(fr)==8 and style.lower().find('fill:#'+fr[:6]) != -1): if (style.lower().find('fill:#'+fr[:6]) != -1 and len(fr) == 6) or (style.lower().find('fill-opacity:'+alphaFr[:4]) != -1 and len(fr)==8 and style.lower().find('fill:#'+fr[:6]) != -1):