rlvgl is a modular, idiomatic Rust reimplementation of LVGL (Light and Versatile Graphics Library).
rlvgl preserves the widget-based UI paradigm of LVGL while eliminating unsafe C-style memory management and global state. This library is structured to support no_std environments, embedded targets (e.g., STM32H7), and simulator backends for rapid prototyping.
The C version of LVGL is included as a git submodule for reference and test vector extraction, but not linked or compiled into this library.
Goals
- Preserve LVGL architecture and layout system
- Replace C memory handling with idiomatic Rust ownership
- Support embedded display flush/input via embedded-hal
- Enable widget hierarchy, styles, and events using Rust traits
- Use existing Rust crates where possible (e.g., embedded-graphics, heapless, tinybmp)
Features
- no_std + allocator support
- Component-based module layout (core, widgets, platform)
- Simulatable via std-enabled feature flag
- Pluggable display and input backends
- Optional Lottie support via the
rlottiecrate for dynamic playback. Embedded targets should pre-render animations to APNG for minimal size.
Project Structure
- core/ – Widget base trait, layout, event dispatch
- widgets/ – Rust-native reimplementations of LVGL widgets
- platform/ – Display/input traits and HAL adapters
- support/ – Fonts, geometry, style, color utils
- lvgl/ – C submodule (reference only)
- rlvgl-sim/ – Desktop simulator example
Status
As-built. See TODO for component-by-component progress.
As of 0.1.0 many features are implemented and an 87% unit test coverage is achived, but functional testing has and bare metal testing have not occured.
Quick Example
use Rect;
use Label;
Coverage
LLVM coverage instrumentation is configured via .cargo/config.toml and the
coverage target in the Makefile. Run make coverage to execute the tests
with instrumentation and generate an HTML report under ./coverage/.
rlvgl crate
- The link above is for the top crate which bundles the others and include the simulator.
- rlvgl-core crate
- rlvgl-widgets crate
- rlvgl-platform crate
Run the following Cargo command in your project directory:
Or add the following line to your Cargo.toml:
= "0.1.5"
Dockerhub
The build image used by the Github worflow for this repo is publiclly available on Dockerhub.
Consult the Dockerfile for details on the build environment.
Other useful helper scripts may be found in /scripts.
License
rlvgl is licensed under the MIT license. See LICENSE for more details.