aboutsummaryrefslogtreecommitdiff
path: root/util/ColorOps.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/ColorOps.py')
-rw-r--r--util/ColorOps.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/util/ColorOps.py b/util/ColorOps.py
new file mode 100644
index 0000000..b0d64a7
--- /dev/null
+++ b/util/ColorOps.py
@@ -0,0 +1,11 @@
+import random
+def randomColor():
+ return [random.randint(0,255) for i in range(3)]
+def chooseRandomColor(colorList):
+ return random.choice(colorList)
+def safeColor(c):
+ return [min(channel,255) for channel in c]
+def combineColors(c1,c2):
+ return safeColor([c1[i]+c2[i] for i in range(min(len(c1),len(c2)))])
+def multiplyColor(color, percent):
+ return safeColor([channel*(percent) for channel in color])