Add ability to set CSS classes instead of inline styles (#103)

* Add ability to set CSS classes instead of inline styles

This allows to set a `ClassName` field in `Style` structs. Setting this
field to anything but "" will cause all other styles to be ignored. The
element will then have a `class=` tag instead with the corresponding name.

Possible reasons to use this:
* Including multiple SVGs on the same webside, using the same styles
* Desire to use strict CSP headers

* Add warning that setting `ClassName` will drop all other inline styles
This commit is contained in:
Justin Kromlinger 2018-10-12 02:21:46 +02:00 committed by Will Charczuk
parent 6735e8990a
commit f97f94425f
6 changed files with 120 additions and 7 deletions

View file

@ -18,6 +18,9 @@ type Renderer interface {
// SetDPI sets the DPI for the renderer.
SetDPI(dpi float64)
// SetClassName sets the current class name.
SetClassName(string)
// SetStrokeColor sets the current stroke color.
SetStrokeColor(drawing.Color)