{"id":16940995,"url":"https://github.com/twpayne/go-svg","last_synced_at":"2025-10-25T17:20:55.204Z","repository":{"id":238600958,"uuid":"796916568","full_name":"twpayne/go-svg","owner":"twpayne","description":"Package svg provides convenience methods for creating and writing SVG documents.","archived":false,"fork":false,"pushed_at":"2025-04-03T20:59:10.000Z","size":130,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T19:23:05.133Z","etag":null,"topics":["go","golang","scalable-vector-graphics","svg"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twpayne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-06T21:29:12.000Z","updated_at":"2025-04-03T20:59:09.000Z","dependencies_parsed_at":"2024-05-08T01:29:19.682Z","dependency_job_id":"b439d0d7-fa25-4971-8db1-81043c953d1f","html_url":"https://github.com/twpayne/go-svg","commit_stats":null,"previous_names":["twpayne/go-svg"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twpayne","download_url":"https://codeload.github.com/twpayne/go-svg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248465353,"owners_count":21108244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","scalable-vector-graphics","svg"],"created_at":"2024-10-13T21:08:26.039Z","updated_at":"2025-10-25T17:20:55.078Z","avatar_url":"https://github.com/twpayne.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-svg\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/twpayne/go-svg)](https://pkg.go.dev/github.com/twpayne/go-svg)\n\nPackage `svg` provides convenience methods for creating and writing SVG documents.\n\n## Key Features\n\n* Fluent API for building arbitrarily complex SVG documents.\n* Support for all SVG elements.\n* Support for all SVG units.\n* Compatibility with the standard library's [`encoding/xml`](https://pkg.go.dev/encoding/xml) package.\n* Simple mapping between functions and SVG elements.\n\n## Example\n\n```go\nfunc ExampleNew() {\n    svgElement := svg.New().WidthHeight(4, 4, svg.CM).ViewBox(0, 0, 400, 400).AppendChildren(\n        svg.Title(svg.CharData(\"Example triangle01- simple example of a 'path'\")),\n        svg.Desc(svg.CharData(\"A path that draws a triangle\")),\n        svg.Rect().XYWidthHeight(1, 1, 398, 398, svg.Number).Fill(\"none\").Stroke(\"blue\"),\n        svg.Path().D(svgpath.New().\n            MoveToAbs([]float64{100, 100}).\n            LineToAbs([]float64{300, 100}).\n            LineToAbs([]float64{200, 300}).\n            ClosePath(),\n        )).Fill(\"red\").Stroke(\"blue\").StrokeWidth(svg.Number(3)),\n    )\n    if _, err := svgElement.WriteToIndent(os.Stdout, \"\", \"  \"); err != nil {\n        panic(err)\n    }\n}\n```\n\nOutput:\n\n```xml\n\u003csvg height=\"4cm\" version=\"1.1\" viewBox=\"0 0 400 400\" width=\"4cm\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\n  \u003ctitle\u003eExample triangle01- simple example of a \u0026#39;path\u0026#39;\u003c/title\u003e\n  \u003cdesc\u003eA path that draws a triangle\u003c/desc\u003e\n  \u003crect fill=\"none\" height=\"398\" stroke=\"blue\" width=\"398\" x=\"1\" y=\"1\"\u003e\u003c/rect\u003e\n  \u003cpath d=\"M100,100 L300,100 L200,300 z\" fill=\"red\" stroke=\"blue\" stroke-width=\"3\"\u003e\u003c/path\u003e\n\u003c/svg\u003e\n```\n\n![Output](testdata/triangle01.svg)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwpayne%2Fgo-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwpayne%2Fgo-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwpayne%2Fgo-svg/lists"}