Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pywal/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def rgba(self):
return "rgba(%s,%s,%s,%s)" % (*hex_to_rgb(self.hex_color),
self.alpha_dec)

@property
def hex_argb(self):
"""Convert an alpha hex color to argb hex."""
return "#%02X%s" % (int(int(self.alpha_num) * 255 / 100),
self.hex_color[1:])
Comment on lines +42 to +45
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about this name. Happy to tweak it to your liking.


@property
def alpha(self):
"""Add URxvt alpha value to color."""
Expand All @@ -48,6 +54,11 @@ def alpha_dec(self):
"""Export the alpha value as a decimal number in [0, 1]."""
return int(self.alpha_num) / 100

@property
def alpha_hex(self):
"""Export the alpha value as a hexdecimal number in [00, FF]."""
return "%02X" % (int(int(self.alpha_num) * 255 / 100))

@property
def decimal(self):
"""Export color in decimal."""
Expand Down