Hey, I saw, that you got a get_ip_address() method, but it seems like its obsolete, is there already a other way?
Also i reworked the rgb_to_xy function from the examples, because I always got a slightly greenish color, if I wanted white.
Hope this helps :)
def rgb_xy(rgb: list):
red = rgb[0] / 255
green = rgb[1] / 255
blue = rgb[2] / 255
# convert to XYZ
if red > 0.04045:
red = ((red + 0.055) / 1.055) ** 2.4
else:
red = red / 12.92
if green > 0.04045:
green = ((green + 0.055) / 1.055) ** 2.4
else:
green = green / 12.92
if blue > 0.04045:
blue = ((blue + 0.055) / 1.055) ** 2.4
else:
blue = blue / 12.92
red = red * 100
green = green * 100
blue = blue * 100
# old version
# X = R * 0.412453 + G * 0.357580 + B * 0.180423
# Y = R * 0.212671 + G * 0.715160 + B * 0.072169
# Z = R * 0.019334 + G * 0.119193 + B * 0.950227
factor = 1 / 0.17697
x_xyz = red * factor * 0.49000 + green * factor * 0.31000 + blue * factor * 0.20000
y_xyz = red * factor * 0.17697 + green * factor * 0.81240 + blue * factor * 0.01063
z_xyz = red * factor * 0.00000 + green * factor * 0.01000 + blue * factor * 0.99000
# convert from xyz to xy
x = x_xyz / (x_xyz + y_xyz + z_xyz)
y = y_xyz / (x_xyz + y_xyz + z_xyz)
return [x, y]
Hey, I saw, that you got a get_ip_address() method, but it seems like its obsolete, is there already a other way?
Also i reworked the rgb_to_xy function from the examples, because I always got a slightly greenish color, if I wanted white. Hope this helps :)