Replies: 4 comments 17 replies
-
The thing about SVG is that unlike solid colors in raster graphics it has not only opaque fills via the php-qrcode/src/Output/QRMarkupSVG.php Lines 75 to 90 in c8c37a4 |
Beta Was this translation helpful? Give feedback.
-
SVG has a lot of flexibility, but can you agree that people might expect the image to be the same, given the same parameters? I mean, a solid color (probably white) background for a QR Code is an incredibly common use case. It makes sense that if somebody sets background color (and transparency false) that it would have a background color. Indeed it works exactly like that with other formats. If somebody wants a gradient or something unusual like that, they can still extend the class. That's a bonus of using the flexible SVG format. But for the very common case that many users might want, it makes sense to make the already-existing one-liner option work.
[EDIT: I was wrong on that point. Just use parent and add to the end. Please see this comment. I think the rest regarding basic vs advanced usage still stands.] Heck, just adding something like the following line before the first path would be helpful:
(It wouldn't help my "make a file for download" situation, but it would be helpful for easy CSS styling.) Best would be that if transparency is false, and if a background color is set, add
If somebody is doing something more complex such as a gradient, they can extend the class as needed and ignore the "basic" background options. So doing this doesn't hurt the people doing advanced stuff, but it greatly simplifies things for people doing basic stuff. |
Beta Was this translation helpful? Give feedback.
-
Quick followup question: If I do extend the EDIT: I see it. |
Beta Was this translation helpful? Give feedback.
-
Can anyone help me achieve colourful QR code using OUTPUT_MARKUP_PNG
Options:
|
Beta Was this translation helpful? Give feedback.
-
Backgrounds behave differently with SVGs compared to other common image formats. Even if you ask for solid background, its not there with SVG. Dev has stated this is because you can style it with CSS anyway, but this doesn't apply if, for example, you're generating an image for download. Even with CSS, there is no obvious element to style. I'm working with circular modules, and even with "visible" background the background itself is also dots with transparent gaps.
Feature request
With SVG format, please:
display:none
.A simple box to style would simplify things greatly. The box following the requested background formatting/color is even better.
Beta Was this translation helpful? Give feedback.
All reactions