Optional
options: RecursivePartial<Options>Optional
options: RecursivePartial<Options>Extension is a function that takes svg and previously applied options and modifies an svg
const extension = (svg, options) => {
const { width, height } = options;
const size = Math.min(width, height);
const border = options.document.createElementNS("http://www.w3.org/2000/svg", "rect");
const borderAttributes = {
fill: "none",
x: (width - size + 40) / 2,
y: (height - size + 40) / 2,
width: size - 40,
height: size - 40,
stroke: "black",
"stroke-width": 40,
rx: 100
};
Object.keys(borderAttributes).forEach((attribute) => {
border.setAttribute(attribute, borderAttributes[attribute]);
});
svg.appendChild(border);
};
The same options as for initialization