svg-builder
svg-builder copied to clipboard
Is it possible to add style element?
Is there any way to add a style element to the svg?
Like this
<style type="text/css">
.st0{fill:#020203;}
.st1{fill:#F1F2F2;}
.st2{fill:#FFFFFF;}
</style>
Thanks for a great simple library!
Hi @elliotsoomro I think that should be possible
Using version 2.0.0 and the syntax;
svg.style(
{},
`
text {
background: #000000AA;
border-radius: 5px;
padding: 5px;
}
`
);
I receive the following error:
Error: Content cannot be a string.
at constructor.checkContent (C:\Projects\***REDACTED***\node_modules\svg-builder\elements\element.js:58:27)
at constructor (C:\Projects\***REDACTED***\node_modules\svg-builder\elements\element.js:20:18)
at new constructor (C:\Projects\***REDACTED***\node_modules\svg-builder\elements\style.js:27:29)
at SvgBuilder.line [as style] (C:\Projects\***REDACTED***\node_modules\svg-builder\index.js:112:21)
It doesn't seem possible currently.