Use variable modes with styles to create multiple design themes programmatically. Variable modes let you define different values for the same variable, enabling you to switch between complete design systems like light and dark themes. This approach reduces variable management overhead and streamlines design workflows through the Designer API.
When you apply a variable mode to a style that uses variables, the applied variables inherit all variable values from that mode. This creates a unified design system where changes to the mode automatically update all dependent styles.
Create a variable mode for a specific collection using the collection.createVariableMode() method. All variable modes created with the Designer API are created as ‘manual’ modes.
Once you’ve created a variable mode, you can set a mode-specific value on a variable using the variable.set() method.
Apply a variable mode to a style using the style.setVariableMode() method. Each variable mode is associated with a variable collection. To apply a variable mode, you must provide the variable collection that belongs to the variable mode.
Currently, you can only set variable modes on primary styles. Variable modes aren’t supported for combo classes through the Designer API.