Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed Mar 31, 2024
1 parent d21b8b6 commit 1a7706e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/iconim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import std/[os, tables, strtabs, xmltree, xmlparser, json]
from std/strutils import indent, join

export XmlAttributes

type
SVGIcon = ref object
path, code: string
attrs: XmlAttributes
attrs*: XmlAttributes

Library = ref object
name: string
Expand Down Expand Up @@ -96,6 +98,11 @@ proc size*(svg: SVGIcon, s: int): SVGIcon =
svg.attrs["height"] = $s
result = svg

proc strokeWidth*(svg: SVGIcon, i: int): SVGIcon =
## Change `stroke-width` attribute value
svg.attrs["stroke-width"] = $i
result = svg

proc `$`*(svg: SVGIcon): string =
if svg != nil:
result = "<svg" & indent(svg.getAttrs(), 1) & ">" & svg.code & "</svg>"
Expand Down

0 comments on commit 1a7706e

Please sign in to comment.