set_variable_value
Sets a variable's value for a specific mode in Figma. Accepts raw values for colors, floats, strings, booleans, or a variable alias.
Instructions
Set a variable's value for a specific mode.
Thin wrapper over Figma's variable.setValueForMode(modeId, value). Call once per mode. Value is a raw value (COLOR/FLOAT/STRING/BOOLEAN) OR an alias object {type: "VARIABLE_ALIAS", id: "VariableID:x:y"}. Hex strings are accepted for COLOR and normalized to {r,g,b,a} in 0-1 range.
Examples: set_variable_value({variable: "VariableID:1:5", mode: "1:0", value: "#FFFFFF"}) set_variable_value({variable: "VariableID:1:5", mode: "1:1", value: {r: 0.1, g: 0.1, b: 0.1, a: 1}}) set_variable_value({variable: "VariableID:1:6", mode: "1:0", value: 16}) set_variable_value({variable: "VariableID:1:7", mode: "1:0", value: {type: "VARIABLE_ALIAS", id: "VariableID:1:9"}})
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variable | Yes | VariableID to set | |
| mode | Yes | Mode id from the variable's collection (e.g. "1:0") | |
| value | Yes | Raw value (COLOR/FLOAT/STRING/BOOLEAN) or {type: "VARIABLE_ALIAS", id} |