Replies: 2 comments
-
Sorry, answer is obvious:
were styling starts and finishes with <style> and </style> |
Beta Was this translation helpful? Give feedback.
0 replies
-
You could keep the CSS variable and pass the value from JS via the style attribute: <svg ... style="--someColor: {color}"> (This is the generally recommended approach to parameterizing styles.) Another approach would be to generate a complete style element string and insert it via <script>
// ...
const style = `<style>
.someClass {
fill: ${color};
}
</style>`;
</script>
<svg xmlns="http://www.w3.org/2000/svg">
{@html style}
...
</svg> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to rewrite my TopoEditor from VueJs to Svelte (as I've decided to use Svelte throughout my projects).
In VueJS, I added styling to the SVG, where styling is a computed string based on 20+ variables, as follows:
However, this does not work in Svelte. In Svelte, I can put:
But:
Any ideas how I can solve this problem.
Beta Was this translation helpful? Give feedback.
All reactions