CairoSVG icon indicating copy to clipboard operation
CairoSVG copied to clipboard

Add custom css during convertion

Open titouancreach opened this issue 6 years ago • 1 comments

The doc says the styling is possible via CSS. It would be good to add a custom css stylesheet as an argument for the convertion.

custom_css = """
  path {
    color: #00FF00;
    fill: #00FF00;
  }
"""
cairosvg.svg2png(
    url="/path/to/input.svg", write_to="/tmp/output.png", style=custom_css) 

expected: Green png at the end

Thanks

titouancreach avatar Oct 31 '17 09:10 titouancreach

I agree. I am generating SVGs on the fly using python and that would be a super useful feature.

J4bbi avatar Sep 28 '18 21:09 J4bbi