1 import coloreffect
3 import inkex
5 class C(coloreffect.ColorEffect):
6 def __init__(self):
7 coloreffect.ColorEffect.__init__(self)
8 self.OptionParser.add_option("-f", "--from_color", action="store", type="string", dest="from_color", default="000000", help="Replace color")
9 self.OptionParser.add_option("-t", "--to_color", action="store", type="string", dest="to_color", default="000000", help="By color")
11 def colmod(self,r,g,b):
12 this_color = '%02x%02x%02x' % (r, g, b)
14 fr = self.options.from_color.strip('"').replace('#', '')
15 to = self.options.to_color.strip('"').replace('#', '')
17 #inkex.debug(this_color+"|"+fr+"|"+to)
18 if this_color == fr:
19 return to
20 else:
21 return this_color
23 c = C()
24 c.affect()