Spaces:
Runtime error
Runtime error
File size: 622 Bytes
94ff611 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
class Color:
@property
def a(self):
return self._a
@property
def r(self):
return self._r
@property
def g(self):
return self._g
@property
def b(self):
return self._b
def __init__(self, a, r, g, b):
self._a = a
self._r = r
self._g = g
self._b = b
@staticmethod
def fromArgb(a, r, g, b):
return Color(a, r, g, b)
@staticmethod
def fromRgb(r, g, b):
return Color(0xff, r, g, b)
def __eq__(self, other):
return self.a == other.a and self.r == other.r and self.g == other.g and self.b == other.b
def __str__(self):
return 'ARGB({},{},{},{})'.format(self.a, self.r, self.g, self.b)
|