aboutsummaryrefslogtreecommitdiff
path: root/util/ColorOps.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/ColorOps.py')
-rw-r--r--util/ColorOps.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/ColorOps.py b/util/ColorOps.py
index b0d64a7..88a58a7 100644
--- a/util/ColorOps.py
+++ b/util/ColorOps.py
@@ -7,5 +7,13 @@ 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 fastMultiply(color, percent, acc=100):
+ percent = int(percent*acc)
+ color = colorToInt(color)
+ color = [channel*percent for channel in color]
+
+def colorToInt(color):
+ return [int(channel) for channel in color]
def multiplyColor(color, percent):
+
return safeColor([channel*(percent) for channel in color])