In Canvas, I dropped in a loop toggle button. But it’s only one color whether the loop is active or not. I’d like it to behave more like the Play/Stop button and change color depending upon whether the loop is off or on.
What happens is that /loop/toggle just flips the state.
If you want Play/Stop-style behavior (where the color reflects the actual loop state), you need explicit ON and OFFcommands, and read the loop state dynamically.
I’ve attached a ready-to-use button here for you to try: Loop Button.json (879 Bytes)
But here’s the code as well, in case anyone else finds it useful:
You can achieve this by changing the button type to Script, and using the following:
Button → Script (On Press)
const on = !!osc("/setlist/loopEnabled");
sendOsc(on ? "/loop/escape" : "/loop/enable");
Set Background Color to Dynamic and paste:
${osc("/setlist/loopEnabled") ? "yellow-600" : "yellow-800"}
// adjust colors to taste