Skip to content

Instantly share code, notes, and snippets.

@kamescg
Created July 23, 2022 09:31
Show Gist options
  • Save kamescg/797b9c870923f0c35e5fe35db282d1f0 to your computer and use it in GitHub Desktop.
Save kamescg/797b9c870923f0c35e5fe35db282d1f0 to your computer and use it in GitHub Desktop.
SVG Render Example
function render() public view returns (string memory) {
string memory _defs = WidgetRouter(_widgetRouter).fetch(_defId, bytes(abi.encodePacked("0x")));
return
string(
abi.encodePacked(
svg.start(),
svg.text(
string.concat(
svg.prop("x", "50%"),
svg.prop("y", "50%"),
svg.prop("dominant-baseline", "middle"),
svg.prop("text-anchor", "middle"),
svg.prop("font-size", "48px"),
),
string.concat("SVG")
),
svg.end()
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment