aboutsummaryrefslogtreecommitdiff
path: root/core.py
diff options
context:
space:
mode:
authortassaron2017-05-22 22:25:38 -0400
committertassaron2017-05-22 22:25:38 -0400
commit431b9f63048850f6e3151b1bfd8650143f50dfe7 (patch)
tree03b1bf87e46d83fc349401b0d4b573aad493cd58 /core.py
parent07644f03486e4812ac85839b5eaba9f8bbbf890a (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.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/core.py b/core.py
index b693837..6981b87 100644
--- a/core.py
+++ b/core.py
@@ -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)