summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8d70e3f)
raw | patch | inline | side by side (parent: 8d70e3f)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 10 Jul 2007 15:53:35 +0000 (15:53 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 10 Jul 2007 15:53:35 +0000 (15:53 +0000) |
share/extensions/Makefile.am | patch | blob | history | |
share/extensions/color_replace.inx | [new file with mode: 0644] | patch | blob |
share/extensions/color_replace.py | [new file with mode: 0644] | patch | blob |
index 7d3a00bb2710074276b9625e6c91d059a2bdf993..e15df2f3891aa65a362f262967f9d89a8ca676dc 100644 (file)
color_removegreen.py\
color_removered.py\
color_rgbbarrel.py\
+ color_replace.py\
cspsubdiv.py \
cubicsuperpath.py \
dia2svg.sh \
color_removegreen.inx\
color_removered.inx\
color_rgbbarrel.inx\
+ color_replace.inx\
dia.inx \
dots.inx \
dxf_input.inx \
diff --git a/share/extensions/color_replace.inx b/share/extensions/color_replace.inx
--- /dev/null
@@ -0,0 +1,18 @@
+<inkscape-extension>\r
+ <_name>Replace color...</_name>\r
+ <id>org.inkscape.color.replacecolor</id>\r
+ <dependency type="executable" location="extensions">coloreffect.py</dependency>\r
+ <dependency type="executable" location="extensions">color_replace.py</dependency>\r
+ <dependency type="executable" location="extensions">simplestyle.py</dependency>\r
+ <param name="from_color" type="string" gui-text="Replace color (RRGGBB hex):">000000</param>
+ <param name="to_color" type="string" gui-text="By color (RRGGBB hex):">000000</param>
+ <effect>\r
+ <object-type>all</object-type>\r
+ <effects-menu>\r
+ <submenu _name="Color"/>\r
+ </effects-menu>\r
+ </effect>\r
+ <script>\r
+ <command reldir="extensions" interpreter="python">color_replace.py</command>\r
+ </script>\r
+</inkscape-extension>
\ No newline at end of file
diff --git a/share/extensions/color_replace.py b/share/extensions/color_replace.py
--- /dev/null
@@ -0,0 +1,34 @@
+import coloreffect\r
+
+import inkex
+\r
+class C(coloreffect.ColorEffect):\r
+ def __init__(self):
+ coloreffect.ColorEffect.__init__(self)
+ self.OptionParser.add_option("-f", "--from_color", action="store", type="string", dest="from_color", default="000000", help="Replace color")
+ self.OptionParser.add_option("-t", "--to_color", action="store", type="string", dest="to_color", default="000000", help="By color")
+
+ def colmod(self,r,g,b):\r
+ this_color = '%02x%02x%02x' % (r, g, b)\r
+
+ if self.options.from_color[0] == '"':
+ self.options.from_color = self.options.from_color[1:]
+ if self.options.from_color[0] == '#':
+ self.options.from_color = self.options.from_color[1:]
+ if self.options.from_color[-1] == '"':
+ self.options.from_color = self.options.from_color[:-1]
+ if self.options.to_color[0] == '"':
+ self.options.to_color = self.options.to_color[1:]
+ if self.options.to_color[0] == '#':
+ self.options.to_color = self.options.to_color[1:]
+ if self.options.to_color[-1] == '"':
+ self.options.to_color = self.options.to_color[:-1]
+
+ #inkex.debug(this_color+"|"+self.options.from_color)
+ if this_color == self.options.from_color:
+ return self.options.to_color\r
+ else:
+ return this_color\r
+\r
+c = C()\r
+c.affect()
\ No newline at end of file