[Python] _to_rgb parsing things wrong

I had a problem with the hex_to_rgb and the name_to_rgb not converting to rgb, but rather grb.

So #ff0000 (red) would actually turn the lights to green, and vice versa

I changed line 842 of blinkstick.py from
return tuple([int(s, 16) for s in (hex_digits[1:3], hex_digits[3:5], hex_digits[5:7])])
to
return tuple([int(s, 16) for s in (hex_digits[3:5], hex_digits[1:3], hex_digits[5:7])])
Which fixed the problem. Is this a bug, or is there something I’m overlooking?

Cannot reproduce this. The following example works as expected:

r,g,b = led._hex_to_rgb("#ff0000")
led.set_color(channel=0, index=1, red=r,green=g,blue=b)

Please show your code to get to know what excactly you are doing.

color = raw_input("\nEnter color:\n")
rgb = bstick._hex_to_rgb(color)
bstick.set_led_data(0, rgb * ledcount)

OK. It has nothing to do with the hex_to_rgb. It is the set_led_data, which is in GRB format as shown in the parameter description in blinkstick.py line 445.

ahhhh, so I was over looking something.

I guess there’s no issue then :stuck_out_tongue: