🦄 Logos that stay square: Mantine QR Code 2.2.0

Hey everyone 👋

A bug I filed against myself a few weeks ago: in Mantine QR Code, imageRadius="md" turned the logo into a circle. Not slightly rounded, a full circle.

The reason is a fun one. The logo lives inside an SVG, and inside an SVG a CSS length counts in the SVG's own units. Here one unit is one QR module, so md (8px) became 8 modules on a logo about 6 modules wide.

Measuring the real pixels on screen wasn't the answer either: on a small QR the logo is about 15px wide, so 8px still makes a circle. So the radius is now laid out as on a 64px square and scales with the logo: md is a rounded square at any size, xl a circle.

Four QR codes for the same link, each with an avatar logo in the center, labelled xs, md, lg and xl. The logo's corners get rounder from left to right: almost square at xs, a full circle at xl.

Heads-up, it's a visible change if you already use it. 2.2.0 is also the first version published from GitHub Actions with npm provenance, with no npm token on my laptop.

How do you round a logo inside a QR code: subtle corners, or a full circle?

📚 Docs:
📦 npm:
💻 GitHub:

4 views

Add a comment

Replies

Be the first to reply

Have a question or a thought to share? Add a comment above to start the conversation.