diff options
Diffstat (limited to 'pywal/util.py')
| -rw-r--r-- | pywal/util.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pywal/util.py b/pywal/util.py index 2fe0762..c105a56 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -9,6 +9,7 @@ import shutil import subprocess import sys import platform +import re class Color: @@ -57,10 +58,17 @@ class Color: """Strip '#' from color.""" return self.hex_color[1:] - @property def lighten(self,percent): """Lighten color by percent""" - return lighten_color(self.hex_color,percent/100) + return Color(lighten_color(self.hex_color,float(re.sub(r'[\D\.]','',percent))/100)) + + def darken(self,percent): + """Darken color by percent""" + return Color(darken_color(self.hex_color,float(re.sub(r'[\D\.]','',percent))/100)) + + def saturate(self,percent): + """Saturate a color""" + return Color(saturate_color(self.hex_color,float(re.sub(r'[\D\.]','',percent))/100)) def read_file(input_file): @@ -68,7 +76,6 @@ def read_file(input_file): with open(input_file, "r") as file: return file.read().splitlines() - def read_file_json(input_file): """Read data from a json file.""" with open(input_file, "r") as json_file: |
