rgb转decimal:
def rgbToDecimal(rgbList):
red = rgbList[0]
green = rgbList[1]
blue = rgbList[2]
rgbInt = (red << 16) + (green << 8) + blue
return rgbInt
a = rgbToDecimal([255, 0, 255])
print(a)
decimal转rgb:
def decimalToRgb(rgbInt):
blue = rgbInt& 255
green = (rgbInt>> 8) & 255
red = (rgbInt>> 16) & 255
return red, green, blue
b = decimalToRgb(16711935)
print(b)