Skip to content

Commit 7b0e7dc

Browse files
committed
Reuse default SVG path styles
1 parent ca3e498 commit 7b0e7dc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

qrcode/image/svg.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,17 @@ def process(self):
167167

168168
class SvgCompressedImage(SvgImage):
169169
"""
170-
SVG image builder with goal of smallest possible output, at least among
170+
SVG image builder with goal of the smallest possible output, at least among
171171
algorithms with predictable fast run time.
172172
"""
173173

174+
QR_PATH_STYLE = {
175+
"fill": "#000000",
176+
"fill-opacity": "1",
177+
"fill-rule": "nonzero",
178+
"stroke": "none",
179+
}
180+
174181
needs_processing = True
175182
path: Optional[ET.Element] = None
176183
default_drawer_class: type[QRModuleDrawer] = svg_drawers.SvgCompressedDrawer
@@ -414,7 +421,7 @@ def process(self):
414421
self.path = ET.Element(
415422
ET.QName("path"), # type: ignore
416423
d="".join(self._generate_subpaths()),
417-
fill="#000",
424+
**self.QR_PATH_STYLE,
418425
)
419426
self._img.append(self.path)
420427

0 commit comments

Comments
 (0)