diff options
| author | tassaron | 2017-05-22 22:25:38 -0400 |
|---|---|---|
| committer | tassaron | 2017-05-22 22:25:38 -0400 |
| commit | 431b9f63048850f6e3151b1bfd8650143f50dfe7 (patch) | |
| tree | 03b1bf87e46d83fc349401b0d4b573aad493cd58 /core.py | |
| parent | 07644f03486e4812ac85839b5eaba9f8bbbf890a (diff) | |
colors are configurable in the GUI
any invalid RGB tuple entered will result in white
Diffstat (limited to 'core.py')
| -rw-r--r-- | core.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -194,3 +194,17 @@ class Core(): shell=True ) return sorted([os.path.join(self.tempDir, f) for f in os.listdir(self.tempDir)]) + + @staticmethod + def RGBFromString(string): + ''' turns an RGB string like "255, 255, 255" into a tuple ''' + try: + tup = tuple([int(i) for i in string.split(',')]) + if len(tup) != 3: + raise ValueError + for i in tup: + if i > 255 or i < 0: + raise ValueError + return tup + except: + return (255, 255, 255) |
