summaryrefslogtreecommitdiff
path: root/pywal
diff options
context:
space:
mode:
Diffstat (limited to 'pywal')
-rw-r--r--pywal/colors.py9
-rw-r--r--pywal/util.py15
2 files changed, 14 insertions, 10 deletions
diff --git a/pywal/colors.py b/pywal/colors.py
index 8d5ea87..19c461b 100644
--- a/pywal/colors.py
+++ b/pywal/colors.py
@@ -64,7 +64,7 @@ def create_palette(img, colors, light):
if light:
# Manually adjust colors.
raw_colors[7] = raw_colors[0]
- raw_colors[0] = util.lighten_color(raw_colors[15], 0.85)
+ raw_colors[0] = util.lighten_color(raw_colors[15], 0.90)
raw_colors[15] = raw_colors[7]
raw_colors[8] = util.lighten_color(raw_colors[7], 0.25)
@@ -75,7 +75,6 @@ def create_palette(img, colors, light):
# Manually adjust colors.
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.blend_color(raw_colors[15], "#EEEEEE")
colors = {"wallpaper": img, "alpha": util.Color.alpha_num,
@@ -86,10 +85,12 @@ def create_palette(img, colors, light):
if light:
for i, color in enumerate(raw_colors):
- color = util.darken_color(color, 0.30)
- colors["colors"]["color%s" % i] = util.saturate_color(color, 50)
+ colors["colors"]["color%s" % i] = util.saturate_color(color, 0.5)
colors["colors"]["color0"] = raw_colors[0]
+ colors["colors"]["color7"] = raw_colors[15]
+ colors["colors"]["color8"] = util.darken_color(raw_colors[0], 0.5)
+ colors["colors"]["color15"] = raw_colors[15]
else:
for i, color in enumerate(raw_colors):
diff --git a/pywal/util.py b/pywal/util.py
index 5550eec..a2325e8 100644
--- a/pywal/util.py
+++ b/pywal/util.py
@@ -1,6 +1,7 @@
"""
Misc helper functions.
"""
+import colorsys
import json
import os
import shutil
@@ -124,12 +125,14 @@ def blend_color(color, color2):
def saturate_color(color, amount):
"""Saturate a hex color."""
r, g, b = hex_to_rgb(color)
-
- r2 = r + amount
- g2 = g + amount
- b2 = b + amount
-
- return rgb_to_hex((r2, g2, b2))
+ r, g, b = [x/255.0 for x in (r, g, b)]
+ h, s, v = colorsys.rgb_to_hsv(r, g, b)
+ s = amount
+ v = 0.2
+ r, g, b = colorsys.hls_to_rgb(h, s, v)
+ r, g, b = [x*255.0 for x in (r, g, b)]
+
+ return rgb_to_hex((int(r), int(g), int(b)))
def disown(cmd):