summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Coyle <loic.coyle@hotmail.fr>2020-03-02 17:43:54 +0100
committerLoic Coyle <loic.coyle@hotmail.fr>2020-03-02 17:43:54 +0100
commit8e6f6d356c0a9f987827b7ab8c4c871a25789dd8 (patch)
tree92535f82cb3d42d542e77650266da29e811f3da2
parent27dff31cbd11f5cb397887f74152452e182333eb (diff)
parent94b0ca58068eb3dc27e19f1428daf70760ec5315 (diff)
Merge branch 'master' of ssh://github.com/dylanaraps/pywal
-rw-r--r--pywal/util.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/pywal/util.py b/pywal/util.py
index cd6628a..7a6787e 100644
--- a/pywal/util.py
+++ b/pywal/util.py
@@ -58,6 +58,21 @@ class Color:
"""Strip '#' from color."""
return self.hex_color[1:]
+ @property
+ def red(self):
+ """Red value as float between 0 and 1."""
+ return "%.3f" % (hex_to_rgb(self.hex_color)[0]/255.)
+
+ @property
+ def green(self):
+ """Green value as float between 0 and 1."""
+ return "%.3f" % (hex_to_rgb(self.hex_color)[1]/255.)
+
+ @property
+ def blue(self):
+ """Blue value as float between 0 and 1."""
+ return "%.3f" % (hex_to_rgb(self.hex_color)[2]/255.)
+
def lighten(self, percent):
"""Lighten color by percent"""
percent = float(re.sub(r'[\D\.]', '', str(percent)))