fillColor: 'rgb(R,G,B)'
rgb\(([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})\)
#!/usr/bin/env python2
import re
with open("source_raw.txt") as f:
source_raw=f.read()
def repl(m):
def fix(v, delta=50):
n = int(v) - delta
return n if n >= 0 else 0
return "rgb({r},{g},{b})".format(r=m.group(1), g=fix(m.group(2)), b=fix(m.group(3)))
source=re.sub(r'rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)', repl, source_raw)
with open("source.txt", "w") as f:
f.write(source)