From a5a7242ae036a2dbd75ec40b8677ffa9b77f3209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20W=C3=BCstenberg?= Date: Tue, 15 Nov 2022 14:48:01 +0100 Subject: [PATCH] Add stroke-width SVG attribute (#116) --- svg/attributes.go | 4 ++++ svg/attributes_test.go | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/svg/attributes.go b/svg/attributes.go index 10b7c69..52c9c61 100644 --- a/svg/attributes.go +++ b/svg/attributes.go @@ -24,6 +24,10 @@ func Stroke(v string) g.Node { return g.Attr("stroke", v) } +func StrokeWidth(v string) g.Node { + return g.Attr("stroke-width", v) +} + func ViewBox(v string) g.Node { return g.Attr("viewBox", v) } diff --git a/svg/attributes_test.go b/svg/attributes_test.go index c41fb45..7e26548 100644 --- a/svg/attributes_test.go +++ b/svg/attributes_test.go @@ -11,12 +11,13 @@ import ( func TestSimpleAttributes(t *testing.T) { cases := map[string]func(string) g.Node{ - "clip-rule": ClipRule, - "d": D, - "fill": Fill, - "fill-rule": FillRule, - "stroke": Stroke, - "viewBox": ViewBox, + "clip-rule": ClipRule, + "d": D, + "fill": Fill, + "fill-rule": FillRule, + "stroke": Stroke, + "stroke-width": StrokeWidth, + "viewBox": ViewBox, } for name, fn := range cases {