r, g, b = backlight.rgb(r, g, b) line wont accomplish anything, since
rgb doesn’t return a value.
Internally the Display-o-Tron backlight is 19 individual LEDs, with no concept of an RGB colour that applies to them all.
So you should either keep track of the r, g and b values yourself, or the on/off state or perhaps even both.
r, g, b, on = 255, 42, 255, True
def button_a(button, pressed):
on = not on
backlight.rgb(r * on, g * on, b * on)
It’s a naughty thing to rely upon, but Python will silently treat “True” and “False” as 1 and 0 for the purpose of mathematical operations, so:
>>> 42 * False
>>> 42 * True
The above would mean your r, g, b backlight colour and the on/off state are separate properties so you can change the r, g, b elsewhere and toggle the backlight on/off.