QR element
The <qr>
element in BML is designed to embed QR codes within BML content. QR codes can encode URLs, text, or other data, offering a quick and easy way for users to access information or perform actions by scanning the code with a QR code reader.
Attributes
The QR element supports several attributes that allow customization of the QR code's appearance and functionality. Below is a detailed description of each attribute.
Attribute Name | Required | Type | Description |
---|---|---|---|
backgroundColor | No | Hex value | Sets the background color of the QR code. The default is usually white. |
foregroundColor | No | Hex value | Defines the color of the data modules (the "pixels" of the QR code). The default is usually black. |
level | No | String | Determines the error correction level. The error correction capability is a feature that allows QR codes to be scanned successfully even if a portion of the code is missing or altered. This is achieved through the inclusion of additional data within the QR code that can be used to reconstruct the information in case of damage. Possible values are 'L', 'M', 'Q', 'H', each offering different degrees of error correction capability: - L (Low): Allows for recovery of up to 7% of the missing or damaged data. - M (Medium): Allows for recovery of up to 15% of the missing or damaged data. - Q (Quartile): Allows for recovery of up to 25% of the missing or damaged data. - H (High): Allows for recovery of up to 30% of the missing or damaged data. |
size | No | Number | Specifies the size of the QR code in pixels. |
title | No | String | Adds a title to the QR code. While not visually represented in the QR code itself, it can be used for accessibility or metadata purposes. |
The content of the QR code should be enclosed between the <qr>
and </qr>
elements.
Examples
Basic QR Code
Generates a QR code of size 200x200 pixels, with a medium error correction level, black foreground, and white background.
<bml>
<qr size="200" level="M" title="QR Code Title" foregroundColor="#000000" backgroundColor="#FFFFFF">
Example QR
</qr>
</bml>