1 unstable release
Uses new Rust 2024
| 0.1.0 | Nov 13, 2025 |
|---|
#4 in #dots
275KB
81 lines
Render a QR code as qpui elements
A simple Component to render a QR code as qpui elements with gpui-native APIs for customization and flexibility.
To render a QR code just pass the size and a vector of booleans representing the data, where true means this block needs to be rendered as a dark square. The size indicates how many columns to sort the qrcode into, thus the data should usually have the a length of size squared.
Examples:
use gpui_qrcode::QrCode;
use gpui::prelude::*;
let qr_code = QrCode::new(10, vec![true, false, true, false]);
You can also customize the appearance of the QR code by applying styles:
use gpui_qrcode::QrCode;
use gpui::prelude::*;
let qr_code = QrCode::new(10, vec![true, false, true, false])
.bg(gpui::blue())
.p_2();
To customize the appearance of the QR code dots use the refine_dot_style method:
use gpui_qrcode::QrCode;
use gpui::{prelude::*, StyleRefinement};
let qr_code = QrCode::new(10, vec![true, false, true, false])
.bg(gpui::blue())
.p_2()
.refine_dot_style(&StyleRefinement {
background: Some(gpui::red().into()),
..Default::default()
});
Simple QR Code Rendering component for gpui
Description
This is a simple QR code rendering component for gpui. It allows you to easily render QR codes in your gpui applications. It has a gpui-styled-based API to customize the appearance of the QR code to your liking.
Example
Quick Start
Add via cargo add gpui-qrcode or manually to your Cargo.toml
[dependencies]
gpui-qrcode = "0.1.0"
For an example usage see the simple example.
Cargo Features
qrcode-support(enabled by default) brings support to directly convert the widget from a QRCode generated by the greatqrcode-crate.
Dependencies
~44–87MB
~1.5M SLoC
