Generate LVGL C source files from Figma XML exports
Project description
figma2lvgl — Figma to LVGL C Code Generator
A code-generation tool that converts Figma UI layouts into LVGL C source files ready to drop into any embedded project.
- Works with any LVGL v9 project (ESP-IDF, Zephyr, bare-metal, etc.)
- Installable via pip — no manual script setup
- Fully cross-platform — Windows, Linux, macOS
✨ Key Features
- 📐 Figma XML → Deterministic C code
- 🧵 Thread-safe UI updates via worker queue
- 🧱 Static metadata-driven UI (
ui_screen_t,ui_child_t) - 📦 Generates self-contained
ui_src/folder - 🔁 Versioned runtime (safe upgrades)
- 🧩 Extensible via template system
- 🎯 Zero dynamic layout parsing at runtime
🚀 Installation
pip install figma2lvgl
Prerequisite — LVGLImage.py
Image conversion requires LVGLImage.py from the official LVGL repository.
On first run, figma2lvgl will ask to download and cache it automatically.
You can also place it manually next to your XML file.
📖 Usage
figma2lvgl -x diagram.xml
All arguments:
| Argument | Description | Default |
|---|---|---|
-x |
Path to Figma XML file | Required |
-i |
Folder containing PNG images | Same directory as XML |
-d |
Destination for generated output | Same directory as XML |
Examples:
# Minimal — everything next to the XML
figma2lvgl -x /home/user/project/layout.xml
# Full control
figma2lvgl -x layout.xml -i assets/images -d build/output
# Windows
figma2lvgl -x E:\project\layout.xml -i E:\project\images -d E:\project\output
📁 Output Layout
Running the tool produces a ui_src/ folder at the destination:
ui_src/
src/ ← Generated screen .c files
include/ ← Generated screen .h files
priv_src/ ← Converted image .c files
priv_include/ ← Image headers + assets.h + ui_defs.h
CMakeLists.txt ← Ready to include in your build system
Drop ui_src/ into your project as a component or library.
🧠 Architecture Overview
Figma XML
↓
Parser
↓
Model (Screen + Children)
↓
Templates
↓
Generated Code (ui_src/)
├── src/
├── include/
├── priv_src/
└── priv_include/
🧩 Extending with New GUI Elements
To add a new UI element:
- Create a new template inside
core/templates/ - Register it in
child_registry.py - Use naming tokens in Figma (e.g.
_button)
No changes to the generator core required.
💡 Examples
See the examples/ folder for complete project setups:
examples/
espidf/
ili9486/ ← ESP-IDF project with ILI9486 display
🏁 Design Philosophy
- Figma = layout only
- Naming conventions = semantics
- Generator = metadata builder
- Output = portable C, no runtime dependencies beyond LVGL
- All UI updates = thread-safe
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file figma2lvgl-0.1.0.tar.gz.
File metadata
- Download URL: figma2lvgl-0.1.0.tar.gz
- Upload date:
- Size: 51.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3b798993fb7cc629fcc352ee380ac4ab782ec67ed7c13b1e2c06bb66b1989cc
|
|
| MD5 |
fbc38344e901cda5ce4a8d1f60416a55
|
|
| BLAKE2b-256 |
4c25ac8055d195412179575984fd007e85b51a062a58ad50ef71c2e91a75467f
|
Provenance
The following attestation bundles were made for figma2lvgl-0.1.0.tar.gz:
Publisher:
publish.yml on khiyamiftikhar/figma2lvgl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
figma2lvgl-0.1.0.tar.gz -
Subject digest:
f3b798993fb7cc629fcc352ee380ac4ab782ec67ed7c13b1e2c06bb66b1989cc - Sigstore transparency entry: 1059375356
- Sigstore integration time:
-
Permalink:
khiyamiftikhar/figma2lvgl@5c4ce372b57a3a3bab1ac41b4f297733e109008d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/khiyamiftikhar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5c4ce372b57a3a3bab1ac41b4f297733e109008d -
Trigger Event:
push
-
Statement type:
File details
Details for the file figma2lvgl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: figma2lvgl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3eedbff491eec7cff9fa85db5ccaba9caad1eb068fc28fcf3dcab8c6c8f173
|
|
| MD5 |
b2a11b65f5032a742fc1c005c5478ea1
|
|
| BLAKE2b-256 |
e5fbbf3cad37670067ef75e378f0c31606209cbeac957fd87584d0ce37b52007
|
Provenance
The following attestation bundles were made for figma2lvgl-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on khiyamiftikhar/figma2lvgl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
figma2lvgl-0.1.0-py3-none-any.whl -
Subject digest:
7b3eedbff491eec7cff9fa85db5ccaba9caad1eb068fc28fcf3dcab8c6c8f173 - Sigstore transparency entry: 1059375359
- Sigstore integration time:
-
Permalink:
khiyamiftikhar/figma2lvgl@5c4ce372b57a3a3bab1ac41b4f297733e109008d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/khiyamiftikhar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5c4ce372b57a3a3bab1ac41b4f297733e109008d -
Trigger Event:
push
-
Statement type: