Created
July 23, 2022 09:31
-
-
Save kamescg/797b9c870923f0c35e5fe35db282d1f0 to your computer and use it in GitHub Desktop.
SVG Render Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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