small fix in colorreplace
This commit is contained in:
parent
8d166db8a7
commit
380fc41cf6
@ -44,12 +44,13 @@ class ReplaceColorAndAlpha(inkex.EffectExtension):
|
|||||||
fr = self.options.from_color.strip('"').strip('#').lower()
|
fr = self.options.from_color.strip('"').strip('#').lower()
|
||||||
try:
|
try:
|
||||||
alphaFr = str(float(int(self.options.from_color.strip('"').strip('#').lower()[-2:], 16))/255.0)
|
alphaFr = str(float(int(self.options.from_color.strip('"').strip('#').lower()[-2:], 16))/255.0)
|
||||||
except:zz
|
except:
|
||||||
pass
|
pass
|
||||||
to = self.options.to_color.strip('"').strip('#').lower()
|
to = self.options.to_color.strip('"').strip('#').lower()
|
||||||
try:
|
try:
|
||||||
alphaTo = str(float(int(self.options.to_color.strip('"').strip('#').lower()[-2:], 16))/255.0)
|
alphaTo = str(float(int(self.options.to_color.strip('"').strip('#').lower()[-2:], 16))/255.0)
|
||||||
except:
|
except Exception as e:
|
||||||
|
inkex.utils.debug(e)
|
||||||
pass
|
pass
|
||||||
svg = self.document.getroot()
|
svg = self.document.getroot()
|
||||||
for element in svg.iter("*"):
|
for element in svg.iter("*"):
|
||||||
@ -65,7 +66,6 @@ class ReplaceColorAndAlpha(inkex.EffectExtension):
|
|||||||
|
|
||||||
style = style + ";fill-opacity:" + alphaTo
|
style = style + ";fill-opacity:" + alphaTo
|
||||||
element.set('style',style)
|
element.set('style',style)
|
||||||
|
|
||||||
if (style.lower().find('stroke:#'+fr[:6]) != -1 and len(fr) == 6) or (style.lower().find('stroke:#'+fr[:6]) != -1 and style.lower().find('stroke-opacity:'+alphaFr[:4]) != -1 and len(fr)==8):
|
if (style.lower().find('stroke:#'+fr[:6]) != -1 and len(fr) == 6) or (style.lower().find('stroke:#'+fr[:6]) != -1 and style.lower().find('stroke-opacity:'+alphaFr[:4]) != -1 and len(fr)==8):
|
||||||
style = re.sub('stroke-opacity:.*?(;|$)',
|
style = re.sub('stroke-opacity:.*?(;|$)',
|
||||||
'\\1',
|
'\\1',
|
||||||
|
Loading…
Reference in New Issue
Block a user