QrCodeWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Displays a QR code in the terminal using block characters.
public sealed record QrCodeWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<QrCodeWidget>Inheritance
Object → Hex1bWidget → QrCodeWidget
Implements
Constructors
QrCodeWidget(string, int)
Displays a QR code in the terminal using block characters.
Parameters:
Data(String): The data to encode in the QR code (typically a URL).QuietZone(Int32): The number of module widths to use as a border around the QR code. Defaults to 1. Set to 0 to disable the quiet zone.
public QrCodeWidget(string Data, int QuietZone = 1)Properties
Data
The data to encode in the QR code (typically a URL).
Returns: String
public string Data { get; init; }QuietZone
The number of module widths to use as a border around the QR code. Defaults to 1. Set to 0 to disable the quiet zone.
Returns: Int32
public int QuietZone { get; init; }Remarks
QrCodeWidget renders QR codes using Unicode block characters (█) to create scannable QR codes in the terminal. The primary use case is encoding URLs.
The QR code is automatically sized based on the data length and error correction level. QR codes work best when displayed with a monospace font where character width equals height.
Error correction level is fixed at Q (Quartile - 25% recovery capability) which provides a good balance between data capacity and error recovery.
Examples
Basic URL QR code:
ctx.QrCode("https://github.com/mitchdenny/hex1b")QR code without quiet zone:
ctx.QrCode("https://example.com", quietZone: 0)