Light with 3 status?

Hi community!!! Hope all is ok… happy new year!

Is there an “out of the box” Light widget with 3 status? Such as disabled (gray), off (red) and active (green)? Or I need to create two RedLight/GreenLight widgets one above the other and I show/hide them?


There is an out-of-the-box GreenRedLight

You construct it like a RedLight (for example). But when you pass it the number of the light, it will use that light for the green, and the next numbered light for the red part. In your module code you need to set both values:

// This example code was written freehand, so it might have bugs
enum LightIds {

		// set light 1 to yellow
		// set light 2 to red

	addChild(createLightCentered<TinyLight<GreenRedLight>>(Vec(142.5, 68.5), module, MOD::LIGHT_GREEN_1));
	addChild(createLightCentered<TinyLight<GreenRedLight>>(Vec(142.5, 78.5), module, MOD::LIGHT_GREEN_2));

Here’s one I made earlier (last year) L69 turns off the other condition…

It works nice, thanks!

Maybe they just add additional “border” placing one on top of others, compared with a single widget rendered on screen. Right?

Well you don’t need to include a border in the other lights you could have them opaque. The border is a stroke and fill, the stroke will always be bigger than the fill. The alpha of the off can be turned all the way down so it is transparent. You then just need 1 border/off position. The draw order is bottom to top, e.g. last draw gets placed on top.

1 Like