karthickn's picture
Upload 6 files
94ff611
raw
history blame contribute delete
622 Bytes
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)