figma-extractor¶
Extract design tokens, screens, components, and image assets from Figma.
| Surface | Name |
|---|---|
| CLI | figma-extractor and python -m figma_extractor |
| Python import | figma_extractor.extract, info, annotate |
| Max-feature installer | python setup.py |
| Docs | this site |
Commands: extract, info, annotate, devices, model validate, model download. Flag tables are on the CLI page. Local Hugging Face models are on the Hugging Face local page. Function signatures and return values are on the Python API page.
pip install figma-extractor or conda install -c vickykumar7125 figma-extractor extracts design data and does not install an LLM provider or PyTorch. The wheel is py3-none-any; the conda package is noarch. setup.py, from a checkout, installs the richest PyTorch profile for this machine on top of that core.
What it supports today¶
- Local
.figarchives (offline kiwi decode, no Figma account needed) - Remote Figma files via the REST API
- Design tokens: colour styles, variables, typography, effects, plus a
tokens.cssbundle - Per-screen layout trees (
trees/) with auto-layout, constraints,styleRefs/variableRefs, fills, text, and expanded component instances - Screen lineage (
origin, optionalsourceScreenId,trees/boards/when boards split) - Shared SVG vectors (
vectorRef) and a unifiedassets/index - UI flow index (
ui-flow.jsonand per-fileLLM.md): roles, regions, sample copy, inferred routes, prototype interactions - Structure: pages, screens, components, variant sets, and unique text content
- Image assets exported with a manifest (sibling
images/copied when extracting a barecanvas.fig) - Optional annotation (
llm-annotations.json) when an LLM extra is installed and explicitly enabled - Optional local Hugging Face models (
HF_BACKEND=local, the default for that provider), with remote Hub inference only whenHF_BACKEND=remote - Fresh rebuilds: each
extractwipes previous deliverables under the output directory (disable with--no-clean) - Temporary
source/andextracted/removed after extract (--keep-intermediatesto retain them)
This package does not render screenshots. HTML generation from an extract is an upcoming feature.
Upcoming: HTML from an extract¶
HTML output is not implemented yet.
A later release will build HTML from the strings and structure this package already writes: trees/*.json, tokens/tokens.css, components.json, assets/manifest.json, and ui-flow.json. The builder will follow the deterministic tree first. When LLM mode is enabled, it may ask the selected provider for recommendations, and those recommendations will stay marked as recommendations. The command will be added beside extract and annotate. python setup.py already installs the provider and torch profile that builder will use.
Notes¶
- A
.figarchive is decoded locally through the embedded kiwi schema, so local extraction works offline. - Remote files are normalized into the same node stream as local
.figfiles, so token, structure, and image builders are shared. - Fonts are not embedded in a
.fig. Typography tokens record family, style, size, line height, and letter spacing.