From e335b4f8da1461936b730f47c6b68dfa9b9b2b6b Mon Sep 17 00:00:00 2001 From: mwfarb Date: Tue, 29 Oct 2024 16:00:04 -0400 Subject: [PATCH] fix(color): ensure color=str assignment publishes correctly --- arena/attributes/color.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arena/attributes/color.py b/arena/attributes/color.py index a398b668..3073519f 100644 --- a/arena/attributes/color.py +++ b/arena/attributes/color.py @@ -29,7 +29,7 @@ def __init__(self, red=0, green=0, blue=0): else: c = (128, 128, 128) else: - c = tuple(int(color[c: c + 2], 16) for c in (0, 2, 4)) + c = tuple(int(color[c:c + 2], 16) for c in (0, 2, 4)) self.red, self.green, self.blue = c if isinstance(red, float): @@ -43,4 +43,7 @@ def __init__(self, red=0, green=0, blue=0): @property def hex(self): - return "#{:02x}{:02x}{:02x}".format(self.red, self.green, self.blue) + if isinstance(self.red, str): + return self.red + else: + return f"#{''.join(f'{i:02x}' for i in [self.red, self.green, self.blue])}"