Same input always produces the same icon. Use the URL, embed the SVG, or generate client-side.
HTML
Copy
<!-- Deterministic avatar -->
<img src ="https://icofy.vercel.app/api/icon/alice?size=128"
alt ="alice" width ="64" height ="64"
style ="image-rendering:pixelated" />
JavaScript
Copy
// Point any <img> at the endpoint
img.src = `https://icofy.vercel.app/api/icon/${encodeURIComponent(user)}?size=128` ;
// Or fetch as blob
const blob = await (await fetch(url)).blob();
React
Copy
function Avatar ({ username, size = 64 }) {
const src = `https://icofy.vercel.app/api/icon/${encodeURIComponent(username)}?size=${size*2}` ;
return (
<img src={src} alt={username} width={size} height={size}
style={{ imageRendering: "pixelated" }} />
);
}
With safe border
Copy
<!-- Padding prevents crop on circular avatars -->
<img src ="https://icofy.vercel.app/api/icon/alice?size=128&pad=1"
alt ="alice" style ="border-radius:50%;image-rendering:pixelated" />