summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pylintrc2
-rw-r--r--pywal/colors.py6
-rw-r--r--pywal/util.py12
3 files changed, 16 insertions, 4 deletions
diff --git a/.pylintrc b/.pylintrc
index 407793d..541dfb1 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,5 +1,5 @@
[BASIC]
-good-names=i,j,k,n,x,y,fg,bg,r,g,b,i3
+good-names=i,j,k,n,x,y,fg,bg,r,g,b,i3,r1,r2,r3,g1,g2,g3,b1,b2,b3
[MESSAGES CONTROL]
# inconsistent-return-statements:
diff --git a/pywal/colors.py b/pywal/colors.py
index fbb045d..4c7e308 100644
--- a/pywal/colors.py
+++ b/pywal/colors.py
@@ -59,16 +59,16 @@ def gen_colors(img, color_count):
def create_palette(img, colors):
"""Sort the generated colors and store them in a dict that
we will later save in json format."""
- raw_colors = colors[:1] + colors[8:] + colors[8:-1]
+ raw_colors = colors[:1] + colors[8:16] + colors[8:-1]
# Darken the background color slightly.
if raw_colors[0][1] != "0":
raw_colors[0] = util.darken_color(raw_colors[0], 0.25)
# Manually adjust colors.
- raw_colors[7] = util.lighten_color(raw_colors[7], 0.25)
+ raw_colors[7] = util.blend_color(raw_colors[7], "#EEEEEE")
raw_colors[8] = util.darken_color(raw_colors[7], 0.30)
- raw_colors[15] = util.lighten_color(raw_colors[15], 0.25)
+ raw_colors[15] = util.blend_color(raw_colors[15], "#EEEEEE")
colors = {"wallpaper": img, "special": {}, "colors": {}}
colors["special"]["background"] = raw_colors[0]
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."""