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

Planned Feature: Support for Template Variables #39

Open
shubhamjain opened this issue Aug 9, 2023 · 0 comments
Open

Planned Feature: Support for Template Variables #39

shubhamjain opened this issue Aug 9, 2023 · 0 comments

Comments

@shubhamjain
Copy link
Owner

Currently, only the properties of root SVG can be modified (Eg, fill and stroke colors). I am planning to extend that to allow to modify anything, provided the SVG is defined in that way.

The use case is that SVG could be modified on the fly and you won't need to create multiple SVGs for the same thing.

Example, let's say you define a file gradient.svg:

<svg height="150" width="400">
  <defs>
    <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" style="stop-color:__to_color__;stop-opacity:1" />
      <stop offset="100%" style="stop-color:__from_color__;stop-opacity:1" />
    </linearGradient>
  </defs>
  <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad2)" />
</svg>

Under this new feature, you'll be able to modify to and from colors, using this:

<svg data-src="./gradient.svg" [from-color]="rgb(255,0,0)" [to-color]="rgb(255,255,0)"></svg>

the benefit here is that it's brief enough and won't conflict with VueJS.

Thoughts? Is this something people would like to see?

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

No branches or pull requests

1 participant