Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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