Merge pull request #529 from sholland1/decimal

Add decimal output support
This commit is contained in:
dylan 2020-05-25 08:29:25 +03:00 committed by GitHub
commit 7fae8d23f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,16 @@ 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 decimal(self):
"""Export color in decimal."""
return "%s%s" % ("#", int(self.hex_color[1:], 16))
@property
def decimal_strip(self):
"""Strip '#' from decimal color."""
return int(self.hex_color[1:], 16)
@property @property
def octal(self): def octal(self):
"""Export color in octal.""" """Export color in octal."""