The Sept 3 "Control opacity at scale" release added color variables that alias another color variable with an opacity override. valuesByMode returns them, but setValueForMode rejects them, and the typings have no shape for them.
Reading works. Variables created in the UI come back as:
// color aliased to {red} at 50% opacity
{ type: 'VARIABLE_EXPRESSION',
expressionFunction: 'COMPOSE_COLOR',
expressionArguments: [{ type: 'VARIABLE_ALIAS', id: 'VariableID:76:8' }, 50] }
// same, with opacity driven by a FLOAT variable
{ type: 'VARIABLE_EXPRESSION',
expressionFunction: 'COMPOSE_COLOR',
expressionArguments: [{ type: 'VARIABLE_ALIAS', id: '…' }, { type: 'VARIABLE_ALIAS', id: '…' }] }
resolveForConsumer() resolves them correctly too ({ r: 1, g: 0, b: 0, a: 0.5 }).
But writing back the exact object just read fails:
const modeId = Object.keys(v.valuesByMode)[0]
v.setValueForMode(modeId, v.valuesByMode[modeId])
// ✗ in setValueForMode: Composed color variable values are not supported
So a plugin can read these variables but can't create them, round-trip them, or migrate them between files. For design-token tools this means dynamic references still have to be flattened to a static hex on write, even though the product now models it natively.
VariableScope is also missing two values the runtime accepts — COLOR_OPACITY (the scope this feature uses) and TRANSFORM:
runtime: … 'OPACITY' | … | 'TRANSFORM' | 'COLOR_OPACITY' | 'STROKE_COLOR' | 'FONT_WEIGHT'
typings: 22 values, both absent
variable.scopes = ['COLOR_OPACITY'] works at runtime today, it just doesn't typecheck.
Request
- Allow
setValueForMode to accept composed color values at runtime.
- Add the composed shape to
VariableValue, and 'COMPOSE_COLOR' to ExpressionFunction.
- Add
'COLOR_OPACITY' and 'TRANSFORM' to VariableScope.
Figma Desktop 126.8.18, @figma/plugin-typings@1.138.0
The Sept 3 "Control opacity at scale" release added color variables that alias another color variable with an opacity override.
valuesByModereturns them, butsetValueForModerejects them, and the typings have no shape for them.Reading works. Variables created in the UI come back as:
resolveForConsumer()resolves them correctly too ({ r: 1, g: 0, b: 0, a: 0.5 }).But writing back the exact object just read fails:
So a plugin can read these variables but can't create them, round-trip them, or migrate them between files. For design-token tools this means dynamic references still have to be flattened to a static hex on write, even though the product now models it natively.
VariableScopeis also missing two values the runtime accepts —COLOR_OPACITY(the scope this feature uses) andTRANSFORM:variable.scopes = ['COLOR_OPACITY']works at runtime today, it just doesn't typecheck.Request
setValueForModeto accept composed color values at runtime.VariableValue, and'COMPOSE_COLOR'toExpressionFunction.'COLOR_OPACITY'and'TRANSFORM'toVariableScope.Figma Desktop 126.8.18, @figma/plugin-typings@1.138.0