Get variable value
variable.get(options?)
Retrieves the value of the variable.
Syntax
Parameters
- options: object - An optional parameter to include get specific information.
- mode: VariableMode - The value of the variable in the specified variable mode.
- customValues: boolean - Indicate whether to return the custom value of the variable. Defaults to false.
Calling
variable.get()
withoutcustomValues: true
will throw an error if the variable has a custom value.
Returns
Returns a Promise that resolves to a value based on the variable type. The return type varies depending on:
- The variable type (Color, Size, Number, etc.)
- Whether the variable is an alias (references another variable)
- Whether custom values are requested (
customValues: true
) - The specified variable mode (
mode
parameter)
Color
Size
Number & Percentage
FontFamily
Custom Value
Returns a value in one of these formats:
- String: e.g.
"red"
,"#ffcc11"
,"#fffcc11"
- Variable reference: ColorVariable
- Custom value: CustomValue
Return Type: Promise<string
| ColorVariable | CustomValue>
Example
Designer ability
Checks for Authorization only