add support for alpha_hex

This commit is contained in:
Chris Hoage 2021-01-08 17:08:21 -08:00
parent f91237f5ab
commit 10e716ca90
No known key found for this signature in database
GPG Key ID: FA6B2BD22EAEE8FF

View File

@ -54,6 +54,11 @@ class Color:
"""Export the alpha value as a decimal number in [0, 1].""" """Export the alpha value as a decimal number in [0, 1]."""
return int(self.alpha_num) / 100 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 @property
def decimal(self): def decimal(self):
"""Export color in decimal.""" """Export color in decimal."""