Code

patch by sas from Bug #199922: speeds up dxf output
[inkscape.git] / share / extensions / color_replace.py
1 import coloreffect\r
2 \r
3 import inkex\r
4 \r
5 class C(coloreffect.ColorEffect):\r
6   def __init__(self):\r
7     coloreffect.ColorEffect.__init__(self)\r
8     self.OptionParser.add_option("-f", "--from_color", action="store", type="string", dest="from_color", default="000000", help="Replace color")\r
9     self.OptionParser.add_option("-t", "--to_color", action="store", type="string", dest="to_color", default="000000", help="By color")\r
10 \r
11   def colmod(self,r,g,b):\r
12     this_color = '%02x%02x%02x' % (r, g, b)\r
13 \r
14     fr = self.options.from_color.strip('"').replace('#', '')\r
15     to = self.options.to_color.strip('"').replace('#', '')\r
16        \r
17     #inkex.debug(this_color+"|"+fr+"|"+to)\r
18     if this_color == fr:\r
19       return to\r
20     else:\r
21       return this_color\r
22 \r
23 c = C()\r
24 c.affect()\r