Skip to content

Enable easy control of SVG QR code colors and styles#3

Open
jerome-toole wants to merge 1 commit intoeducastellano:masterfrom
jerome-toole:patch-1
Open

Enable easy control of SVG QR code colors and styles#3
jerome-toole wants to merge 1 commit intoeducastellano:masterfrom
jerome-toole:patch-1

Conversation

@jerome-toole
Copy link

Currently, when this library is used via qr-code, there's no way to override the colours or styles when in SVG mode.

part attributes were previously added to the HTML table QR version, but not the SVG version which prevented any control over those elements when they were in the shadow DOM.

If the user only needs to control colours, it's simpler just to give them a CSS custom property to edit as CSS variables are inherited into the shadow DOM. I've added --qr--fg and --qr--bg.

  • Add part attributes to generated foreground and background SVG elements.
  • Add --qr--fg and --qr--bg CSS variables with fallbacks to inline SVG styles for easier control of the QR code colors

This issue mentioned a similar issue: educastellano/qr-code#20

Thanks for the qr-code library! 👌

Add part attributes to foreground and background rect element in generateSVG.

Add `--qr--fg` and `--qr--bg` CSS variables for easier control of the QR code colors as CSS variables are inherited into the shadow DOM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant