diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-07-08 22:28:45 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-07-08 22:28:45 +1000 |
| commit | 06a5301fa4f0de823be0e7998900c977b509d0d4 (patch) | |
| tree | 6f168107150f66c4c1719d6821bb78a2927c55ab /pywal/util.py | |
| parent | 36feca84775b98d17c662cb1b3198b8e1dd6b23f (diff) | |
colors: Fix xclock colors.
Diffstat (limited to 'pywal/util.py')
| -rw-r--r-- | pywal/util.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pywal/util.py b/pywal/util.py index aa2a26e..2796d8e 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -7,7 +7,6 @@ import pathlib import subprocess -# pylint: disable=too-few-public-methods class Color: """Color formats.""" def __init__(self, hex_color): @@ -21,6 +20,11 @@ class Color: """Convert a hex color to rgb.""" return hex_to_rgb(self.hex_color) + @property + def xrgba(self): + """Convert a hex color to xrdb rgba.""" + return hex_to_xrgba(self.hex_color) + def set_grey(colors): """Set a grey color based on the brightness @@ -76,6 +80,12 @@ def hex_to_rgb(color): return f"{red},{green},{blue}" +def hex_to_xrgba(color): + """Convert a hex color to xrdb rgba.""" + col = color.lower() + return f"{col[1]}{col[2]}/{col[3]}{col[4]}/{col[5]}{col[6]}/ff" + + def disown(*cmd): """Call a system command in the background, disown it and hide it's output.""" |
