MCPcopy Create free account
hub / github.com/anomalyco/models.dev / labLogoSvg

Function labLogoSvg

packages/web/src/render.tsx:1692–1712  ·  view source on GitHub ↗
(labId: string)

Source from the content-addressed store, hash-verified

1690}
1691
1692function labLogoSvg(labId: string) {
1693 const cached = LabLogoSvgs.get(labId);
1694 if (cached) return cached;
1695
1696 const logoPath = path.join(root, "labs", labId, "logo.svg");
1697 const defaultLogoPath = path.join(root, "providers", "logo.svg");
1698 const rawSvg = readFileSync(
1699 existsSync(logoPath) ? logoPath : defaultLogoPath,
1700 "utf8",
1701 );
1702 const svg = rawSvg
1703 .replace(/<svg\b([^>]*)>/i, (_, attributes: string) => {
1704 const cleaned = attributes.replace(/\s(width|height)="[^"]*"/gi, "");
1705 return `<svg${cleaned} aria-hidden="true" focusable="false">`;
1706 })
1707 .replace(/\sfill="(?!none)[^"]*"/gi, ' fill="currentColor"')
1708 .replace(/\sstroke="(?!none)[^"]*"/gi, ' stroke="currentColor"');
1709
1710 LabLogoSvgs.set(labId, svg);
1711 return svg;
1712}

Callers 1

LabLinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected