Open vickipedia opened 2 years ago
Strange, but seems to work. It needs to be implemented asap.
from colour import Color
# Function
def get_rgb(cols: Color) -> tuple:
ret = []
for Value in cols.rgb:
ret += [round(Value * 255) // 1]
return tuple(ret)
# List comprehension
tuple([round(Value * 255) // 1 for Value in Color(...).rgb])
>>> Colors = "red", "green", "blue", "yellow", "#FACADE"
>>> Colors = [Color(c) for c in Colors]
>>>
>>> for x in Colors:
... print(
... x.hex_l.upper(),
... get_rgb(x)
... )
...
#FF0000 (255, 0, 0)
#008000 (0, 128, 0)
#0000FF (0, 0, 255)
#FFFF00 (255, 255, 0)
#FACADE (250, 202, 222)
Trying to generate a Colour object using 0, 255, 0 RGB value and read back the rgb tuple. Getting a exponential negative value in place of blue.
Also tried,
Color("lime").rgb Color("#00FF00").rgb Color(rgb=(0,1,0)).rgb