def set_color(self, light_id, hex_value, brightness=None):
        light = self.get_light(light_id)

        xy = get_xy_from_hex(hex_value)
        data = {
            'xy': [xy.x, xy.y],
        }

        if brightness is not None:
            data['bri'] = brightness

        return self.set_state(light.light_id, **data)
This will set the light color based on a hex value
dataset/ETHPy150Open sontek/bulby/bulby/client.py/HueBridgeClient.set_color