def __init__(self, R=0, G=0, B=0, *args, **kwargs): # default: Black """ Init self with R (Red), G (Green), B (Blue) """ cB.__init__(self, *args, **kwargs) self.type = 'RGB' # can be used instead of isinstance on an object if R in range(256) and G in range(256) and B in range(256): self.R, self.G, self.B = R, G, B else: self.R = self.G = self.B = 0
def __init__(self, H=-1.0, S=0.0, L=0.0, *args, **kwargs): # default: Black """ Init with H, S, L values """ cB.__init__(self, *args, **kwargs) self.type = 'HSL' # can be used instead of isinstance on an object self.H, self.S, self.L = H, S, L
def __init__(self, Y=0.0, Cb=0.0, Cr=0.0, *args, **kwargs): # default: Black """ Init with Y, Cb, Cr values """ cB.__init__(self, *args, **kwargs) self.type = 'YCbCr' # can be used instead of isinstance on an object self.Y, self.Cb, self.Cr = Y, Cb, Cr
def __init__(self, Y=0.0, Co=0.0, Cg=0.0, *args, **kwargs): # default: Black """ Init with Y, Co, Cg values """ cB.__init__(self, *args, **kwargs) self.type = 'YCoCg' # can be used instead of isinstance on an object self.Y, self.Co, self.Cg = Y, Co, Cg
def __init__(self, Y=0.0, C1=0.0, C2=0.0, *args, **kwargs): # default: Black """ Init with Y, C1, C2 values """ cB.__init__(self, *args, **kwargs) self.type = 'YCC' # can be used instead of isinstance on an object self.Y, self.C1, self.C2 = Y, C1, C2
def __init__(self, Y=0.0, Db=0.0, Dr=0.0, *args, **kwargs): # default: Black """ Init with Y, Db, Dr values """ cB.__init__(self, *args, **kwargs) self.type = 'YDbDr' # can be used instead of isinstance on an object self.Y, self.Db, self.Dr = Y, Db, Dr
def __init__(self, H=0, W=0, B=100, *args, **kwargs): # default: Black """ Init with H, W, B values """ cB.__init__(self, *args, **kwargs) self.type = 'HWB' # can be used instead of isinstance on an object self.H, self.W, self.B = H, W, B self.Ncol = HUEtoNCOL(self.H) self.dfields_HWB = dict(zip(range(len(self.lfields_HWB)), self.lfields_HWB)) self.dfields_NCS = dict(zip(range(len(self.lfields_NCS)), self.lfields_NCS)) self.refs_HWB = lambda: [vars(self)[var] for var in self.lfields_HWB] self.refs_NCS = lambda: [vars(self)[var] for var in self.lfields_NCS]
def __init__(self, R=0, G=0, B=0, Dim=100.0, *args, **kwargs): # default: Black """ Init self with R (Red), G (Green), B (Blue) & Dim (Dimming with limit of 255%... Higher values doesn't make sense) """ cB.__init__(self, *args, **kwargs) self.type = 'RGBDim' # can be used instead of isinstance on an object if R in range(256) and G in range(256) and B in range(256): self.R, self.G, self.B = R, G, B self.Dim = max(0.0, min(Dim, 255.0)) else: self.R = self.G = self.B = 0 self.Dim = 100.0
def __init__(self, htm='#000000', *args, **kwargs): # default: Black """ Init HTML color """ cB.__init__(self, *args, **kwargs) self.type = 'HEX' # can be used instead of isinstance on an object self.R = self.G = self.B = 0 self.HEX = '' self.HEX_int = lambda: int(self.HEX[1:], 16 ) # returns integer base 16 of HEX member self.dfields_RGB = dict( zip(range(len(self.lfields_RGB)), self.lfields_RGB)) self.dfields_HEX = dict( zip(range(len(self.lfields_HEX)), self.lfields_HEX)) self.refs_RGB = lambda: [vars(self)[var] for var in self.lfields_RGB] self.refs_HEX = lambda: [vars(self)[var] for var in self.lfields_HEX] self.update(htm)
def __init__(self, L=0.0, a=0.0, b=0.0, *args, **kwargs): # default: Black """ Init with L*, a, b values """ cB.__init__(self, *args, **kwargs) self.type = 'HunterLab' # can be used instead of isinstance on an object self.L, self.a, self.b = L, a, b
def __init__(self, Y=0.0, U=0.0, V=0.0, *args, **kwargs): # default: Black """ Init with Y, U, V values """ cB.__init__(self, *args, **kwargs) self.type = 'YUV' # can be used instead of isinstance on an object self.Y, self.U, self.V = Y, U, V
def __init__(self, L=0.0, u=0.0, v=0.0, *args, **kwargs): # default: Black """ Init with L*, u, v values """ cB.__init__(self, *args, **kwargs) self.type = 'CIELuv' # can be used instead of isinstance on an object self.L, self.u, self.v = L, u, v
def __init__(self, C=0.0, M=0.0, Y=0.0, K=1.0, *args, **kwargs): # default: Black """ Init with C, M, Y, K values """ cB.__init__(self, *args, **kwargs) self.type = 'CMYK' # can be used instead of isinstance on an object self.C, self.M, self.Y, self.K = C, M, Y, K
def __init__(self, Y=0.0, x=0.0, y=0.0, *args, **kwargs): # default: Black """ Init self with Y, x, y """ cB.__init__(self, *args, **kwargs) ColorChecker.__init__(self, *args, **kwargs) self.type = 'Yxy' # can be used instead of isinstance on an object self.Y, self.x, self.y = Y, x, y
def __init__(self, L=0.0, C=0.0, H=0.0, *args, **kwargs): # default: Black """ Init with L*, C, H° values """ cB.__init__(self, *args, **kwargs) self.type = 'CIELCHab' # can be used instead of isinstance on an object self.L, self.C, self.H = L, C, H
def __init__(self, Y=0.0, I=0.0, Q=0.0, *args, **kwargs): # default: Black """ Init with Y, I, Q values """ cB.__init__(self, *args, **kwargs) self.type = 'YIQ' # can be used instead of isinstance on an object self.Y, self.I, self.Q = Y, I, Q