Skip to main content

Generate LVGL C source files from Figma XML exports

Reason this release was yanked:

wrong version

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:

  1. Create a new template inside core/templates/
  2. Register it in child_registry.py
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

figma2lvgl-0.0.0.tar.gz (51.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

figma2lvgl-0.0.0-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file figma2lvgl-0.0.0.tar.gz.

File metadata

  • Download URL: figma2lvgl-0.0.0.tar.gz
  • Upload date:
  • Size: 51.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for figma2lvgl-0.0.0.tar.gz
Algorithm Hash digest
SHA256 700dd8abbd7e853c97cee65d5c16481c581fc6d710ada054cc341a07ee731c24
MD5 7c68b68db69cfe202c43a760377ffea0
BLAKE2b-256 24e79d34eeb82f6018d5ea70c4ffb4f1536dcc56411f953813fd9ec6ae9a1595

See more details on using hashes here.

Provenance

The following attestation bundles were made for figma2lvgl-0.0.0.tar.gz:

Publisher: publish.yml on khiyamiftikhar/figma2lvgl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file figma2lvgl-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: figma2lvgl-0.0.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

Hashes for figma2lvgl-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9043860c624b70cb5489ebdb5518f465ddd32b36a71f44ba704ccc5a6ee5d8bc
MD5 4305dec6403d53d4e1ffd1884ea33180
BLAKE2b-256 2f48f2ad91fbd248426b74c36ed66696c44214b05687ca993cbd9b1ef7de4a1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for figma2lvgl-0.0.0-py3-none-any.whl:

Publisher: publish.yml on khiyamiftikhar/figma2lvgl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page