diff options
| author | Pepper <pepper@scannerjammer.com> | 2015-03-04 04:28:00 -0500 |
|---|---|---|
| committer | Pepper <pepper@scannerjammer.com> | 2015-03-04 04:28:00 -0500 |
| commit | ca18ef726002bd64d831bc90c26ebe1b42a70069 (patch) | |
| tree | 11ce746f8a2ba1d46ffe7ca8b53bdf06caf54e75 /imgrid.py | |
| parent | 734114b9a6bed13883b9f33e3a5acafc52af07a9 (diff) | |
added is color
Diffstat (limited to 'imgrid.py')
| -rwxr-xr-x | imgrid.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -31,6 +31,11 @@ DEFAULT_LINE_COLOR = "silver" DEFAULT_FINALFORMAT = "png" #{{{Utility functions +def is_color(s): + if re.match('(rgba?\([0-9]+,[0-9]+,[0-9]+\))|([a-zA-Z]+)|(\#[A-Ha-h0-9]+)', s): + return s + else: + raise ValueError def bool_correct(s): if re.match(r'^false$', s, re.IGNORECASE): return False @@ -169,8 +174,8 @@ class Imgrid(): except Exception as e: sys.stderr.write(str(e)) raise; - elif k in [ 'bgcolor', 'planebgcolor' ]: - self.params[k] = params[k] + elif k in [ 'bgcolor', 'planebgcolor','linecolor' ]: + self.params[k] = is_color(params[k]) elif k == 'opacity': self.params[k] = str(float(params[k])) elif k == 'zoom': |
