Work with QR code generation and display. Use when modifying QR functionality, fixing QR rendering, or adding QR features.
Work with QR code generation and display in kheMessage.
/qr or qr.htmlUses qrcode.js library:
function updateQR() {
const el = document.getElementById('qrcode')
if (!el || typeof qrcode !== 'function') return
const url = location.href
try {
const qr = qrcode(0, 'L') // Type 0, Error correction L
qr.addData(url)
qr.make()
el.innerHTML = qr.createSvgTag({ cellSize: 4, margin: 0 })
} catch (e) {
el.innerHTML = ''
}
}
L (7%) - Currently used, smallest sizeM (15%) - MediumQ (25%) - Higher reliabilityH (30%) - Highest reliabilityQR colors adapt to theme:
html.dark #qrcode svg rect {
fill: #292524; /* Background */
}
html.dark #qrcode svg path {
fill: #fafaf9; /* Modules */
}
The QR container has consistent styling:
#qrcode-wrap {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: 12px;
padding: 12px;
box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}