Expand description
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()
});Structsยง
- QrCode
- A simple Component to render a QR code as qpui elements