def attribute_true_color(self, data: bytes): self.reset_colors() code, value = colors.decode_raw_color(struct.unpack('<L', data)[0]) if code == colors.COLOR_TYPE_RGB: self.true_color = colors.rgb2int(value) else: # ACI colors, BYLAYER, BYBLOCK self.color = value
def test_decode_by_block(): assert clr.decode_raw_color(-1056964608) == ( clr.COLOR_TYPE_BY_BLOCK, BYBLOCK, )
def test_decode_aci(): assert clr.decode_raw_color(-1023410164) == (clr.COLOR_TYPE_ACI, 12)
def test_decode_rgb(): assert clr.decode_raw_color(-1039526882) == ( clr.COLOR_TYPE_RGB, (10, 20, 30), )
def test_decode_by_layer(): assert clr.decode_raw_color(-1073741824) == ( clr.COLOR_TYPE_BY_LAYER, BYLAYER, )