variables command lists all design variables and variable collections in a .fig file.
Usage
Arguments
Path to the
.fig fileOptions
Filter by collection name (case-insensitive substring match)
Filter by variable type:
COLOR, FLOAT, STRING, or BOOLEANOutput as JSON
Examples
List all variables
Filter by collection
Filter by type
Get variables as JSON
Variable types
OpenPencil supports four variable types:- COLOR - RGBA color values
- FLOAT - Numeric values (spacing, sizing, opacity, etc.)
- STRING - Text values
- BOOLEAN - True/false values
Variable collections
Collections group related variables and support multiple modes:Value display
Color values
Colors are displayed as hex codes:Numeric values
Floats are displayed as numbers:String values
Strings are displayed as-is:Boolean values
Booleans are displayed astrue or false:
Variable aliases
When a variable references another variable (alias), it’s displayed with an arrow:medium is aliased to the base variable in the Spacing collection.
Modes
Variables can have different values for different modes. The command shows the value for the active mode of each collection. In the example above, the “Colors” collection has “Light” and “Dark” modes, and the displayed value is from the active mode (typically the first mode).Use cases
- Design tokens audit: Review all design tokens in a file
- Documentation: Generate variable reference documentation
- Migration: Export variables for use in code or other tools
- Debugging: Check variable values and aliases
- Filtering: Find all color variables or variables from a specific collection
See also
- Components - Using variables with components
- AI chat - Create variables with AI tools