diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2018-02-03 10:50:22 +1100 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2018-02-03 10:50:22 +1100 |
| commit | a3bedee34a7559451ac26b3f8dcab4d59893312a (patch) | |
| tree | 57626ce94fc24090d897e3498cba79e33ee59ce2 /pywal/util.py | |
| parent | c4b5a667c94f895c3d3c8a61e4a6739185b7b1b6 (diff) | |
colors: Add light theme support.
Diffstat (limited to 'pywal/util.py')
| -rw-r--r-- | pywal/util.py | 15 |
1 files changed, 9 insertions, 6 deletions
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): |
