rename morph_color to morph_channel

master
lub 3 years ago
parent 7affaf04b1
commit 996f007076

@ -20,7 +20,7 @@ def set_all_leds(device, grb=[0,0,0]):
return_value = device.set_led_data(0, grb*32)
sleep(0.02) # minimal delay to not crash the blinkstick
return return_value
def morph_color(color, steps):
def morph_channel(color, steps):
"""
Takes an int between 0-255 and either increments or decreases it by the specified steps.
"""
@ -45,10 +45,10 @@ def morph_grb(grb, steps, mode='single'):
if mode == 'single':
color_index = randint(0, len(grb)-1)
grb[color_index] = morph_color(grb[color_index], steps)
grb[color_index] = morph_channel(grb[color_index], steps)
elif mode == 'all':
for color_index in range(len(grb)):
grb[color_index] = morph_color(grb[color_index], steps)
grb[color_index] = morph_channel(grb[color_index], steps)
else:
raise Exception(f'Mode "{mode}" is not supported.')