How do I change the colour of the toggle button

Is there a method or colourid for changing the colour of the button in a toggle button?

I have another question about the toggle button. Does it not have a listener callback method?

It’s a button - it inherits all the button callbacks. I think you can change its colour by changing the TextButton::buttonColourId colour.

Yes that works. I tried doing ToggleButton::buttonColourId and that didn’t work.

It is not clear to me why this works though. ToggleButton inherits the Button class members but why does it also inherit the TextButton members.

ToggleButton and TextButton both inherit the Button class according to the documentation but not each other’s class. Shouldn’t the reference be Button:buttonColourId?

It just works because the LookAndFeel happens to use that the same utility method to draw the text button and the background of the toggle button.

It did not work for me. Can you please copy and paste a working example. Maybe on the new version things are different.

Thank you

This worked for me…

Toggle.setColour(juce::ToggleButton::textColourId, juce::Colours::black);
Toggle.setColour(juce::ToggleButton::tickColourId, juce::Colours::black);
Toggle.setColour(juce::ToggleButton::tickDisabledColourId, juce::Colours::black);