summaryrefslogtreecommitdiff
path: root/pywal/util.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-01-07 10:03:41 +1100
committerDylan Araps <dylan.araps@gmail.com>2018-01-07 10:03:41 +1100
commite06f53dc96949974e5e36af1bb8bf90c9a533cc9 (patch)
treeb3476c914b6d097fb7ce92114f19b9bb883ea3b0 /pywal/util.py
parentb9d6eb8914cc4e4c7490a4e858fee44f99d7326d (diff)
colors: better sort and better white by blending.
Diffstat (limited to 'pywal/util.py')
-rw-r--r--pywal/util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pywal/util.py b/pywal/util.py
index b8ff682..ad1d9cf 100644
--- a/pywal/util.py
+++ b/pywal/util.py
@@ -109,6 +109,18 @@ def lighten_color(color, amount):
return rgb_to_hex(color)
+def blend_color(color, color2):
+ """Blend two colors together."""
+ r1, g1, b1 = hex_to_rgb(color)
+ r2, g2, b2 = hex_to_rgb(color2)
+
+ r3 = int(0.5 * r1 + 0.5 * r2)
+ g3 = int(0.5 * g1 + 0.5 * g2)
+ b3 = int(0.5 * b1 + 0.5 * b2)
+
+ return rgb_to_hex((r3, g3, b3))
+
+
def disown(cmd):
"""Call a system command in the background,
disown it and hide it's output."""