diff --git a/utils.py b/utils.py index 544ab2b..54f3e38 100644 --- a/utils.py +++ b/utils.py @@ -129,6 +129,9 @@ class Color3i: self.g = g self.b = b + def __str__(self): + return f"{self.__class__.__name__}({self.r}, {self.g}, {self.b})" + class Color4f: """Color RGBA as float""" @@ -138,3 +141,13 @@ class Color4f: self.g = g self.b = b self.a = a + + def __str__(self): + max_precision = 3 + + r = round(self.r, max_precision) + g = round(self.g, max_precision) + b = round(self.b, max_precision) + a = round(self.a, max_precision) + + return f"{self.__class__.__name__}({r}, {g}, {b}, {a})"