mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-07 14:39:46 +01:00
colors: Fix xclock colors.
This commit is contained in:
parent
36feca8477
commit
06a5301fa4
@ -56,8 +56,8 @@ rofi.color-active: {background}, {foreground}, {background}, {color10}, {backgro
|
|||||||
rofi.color-urgent: {background}, {color9}, {background}, {color9}, {foreground}
|
rofi.color-urgent: {background}, {color9}, {background}, {color9}, {foreground}
|
||||||
|
|
||||||
! Xclock colors.
|
! Xclock colors.
|
||||||
XClock*majorColor: {color15}
|
XClock*majorColor: rgba:{color15.xrgba}
|
||||||
XClock*minorColor: {color15}
|
XClock*minorColor: rgba:{color15.xrgba}
|
||||||
XClock*hourColor: {color15}
|
XClock*hourColor: rgba:{color15.xrgba}
|
||||||
XClock*minuteColor: {color15}
|
XClock*minuteColor: rgba:{color15.xrgba}
|
||||||
XClock*secondColor: {color15}
|
XClock*secondColor: rgba:{color15.xrgba}
|
||||||
|
@ -7,7 +7,6 @@ import pathlib
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class Color:
|
class Color:
|
||||||
"""Color formats."""
|
"""Color formats."""
|
||||||
def __init__(self, hex_color):
|
def __init__(self, hex_color):
|
||||||
@ -21,6 +20,11 @@ class Color:
|
|||||||
"""Convert a hex color to rgb."""
|
"""Convert a hex color to rgb."""
|
||||||
return hex_to_rgb(self.hex_color)
|
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):
|
def set_grey(colors):
|
||||||
"""Set a grey color based on the brightness
|
"""Set a grey color based on the brightness
|
||||||
@ -76,6 +80,12 @@ def hex_to_rgb(color):
|
|||||||
return f"{red},{green},{blue}"
|
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):
|
def disown(*cmd):
|
||||||
"""Call a system command in the background,
|
"""Call a system command in the background,
|
||||||
disown it and hide it's output."""
|
disown it and hide it's output."""
|
||||||
|
@ -69,8 +69,10 @@ class TestUtil(unittest.TestCase):
|
|||||||
result = util.hex_to_rgb("#98AEC2")
|
result = util.hex_to_rgb("#98AEC2")
|
||||||
self.assertEqual(result, "152,174,194")
|
self.assertEqual(result, "152,174,194")
|
||||||
|
|
||||||
# Figure out how to test this.
|
def test_hex_to_xrgba(self):
|
||||||
# def test_disown(self):
|
"""> Convert #98AEC2 to XRGBA."""
|
||||||
|
result = util.hex_to_xrgba("#98AEC2")
|
||||||
|
self.assertEqual(result, "98/ae/c2/ff")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user