I have a ToggleButton like this

I would like to change the color on both sides of the ToggleButton in order to represent light/dark modes
Hi there, I have just started using TMS Web core and would like to incorporate a light/dark mode using a ToggleButton, how can I change the color on both sides of the ToggleButton in order to represent the light/dark mode?
So changing the color on a
TWebToggleButtonis a big job! Great question though, because the component doesn't have any properties available to do this in design-time.First, I made a function to change the color:
You pass in the
TWebToggleButtonand theTColorfor it. That will successfully change the color.Then you need to set a default/starting color for the
TWebToggleButtonon the form'sOnCreateevent:And then on the
TWebToggleButton'sonClickevent, you need to change the color every time the user clicks on it as well:And that's it. Now you should have a
TWebToggleButtonwith a custom color set for both sides (Checked and not Checked).Not Checked:
Checked: