HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/inkscape/extensions/color_replace.py
#!/usr/bin/env python
import coloreffect

import inkex

class C(coloreffect.ColorEffect):
  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):
    this_color = '%02x%02x%02x' % (r, g, b)

    fr = self.options.from_color.strip('"').replace('#', '').lower()
    to = self.options.to_color.strip('"').replace('#', '').lower()
       
    #inkex.debug(this_color+"|"+fr+"|"+to)
    if this_color == fr:
      return to
    else:
      return this_color

c = C()
c.affect()