Set solid background for custom svg #283
-
Hi, guys, thank you for you help and your time in advance!
But as a result i want to have an option to add regular solid background |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey, you will need to add a css rule to the $options->svgDefs = '
<linearGradient id="gradient" x1="100%" y2="100%">
<stop stop-color="#D70071" offset="0"/>
<stop stop-color="#9C4E97" offset="0.5"/>
<stop stop-color="#0035A9" offset="1"/>
</linearGradient>
<style><![CDATA[
.dark{fill: url(#gradient);}
.light{fill: red;}
/* here's the background for the whole svg */
svg{background: green;}
]]></style>';
|
Beta Was this translation helpful? Give feedback.
-
Oh, i see, thank you so much! |
Beta Was this translation helpful? Give feedback.
Hey, you will need to add a css rule to the
<style>
section of thesvgDefs
block, such assvg{background: red;}
(note the property name isbackground
orbackground-color
, notfill
here) - alternatively you could just add a background-color via stylesheet to the containing html element or the QR Code svg element itself - its css-selector issvg.qrcode
by default.