Skip to main content
Tricia_Spoonts
July 19, 2023
Solved

Is it possible to trigger off of a variable change

It appears that when you change a variable mode e.g. from light/dark mode it does not trigger a selection or document event. Is there an event that you can hook into on a variable mode change that may not yet be documented.

This topic has been closed for replies.
tank666
tank666Solution
July 19, 2023

I just tested, the documentchange event fires when the variable mode changes. This event does not fire only when you switch from the first mode to auto and vice versa.

This is because the PROPERTY_CHANGE event type does not yet support the explicitVariableModes property.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank

2 replies

tank666
tank666Solution
July 19, 2023

I just tested, the documentchange event fires when the variable mode changes. This event does not fire only when you switch from the first mode to auto and vice versa.

This is because the PROPERTY_CHANGE event type does not yet support the explicitVariableModes property.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Tricia_Spoonts
July 19, 2023

Thank you @tank666 I see that it was not firing because I didn’t have any colors in my test document that changed. Never start coding after 11pm 🙂