logoapi-script
v0.1.4
Published
Stock and crypto logos for pages that can only load scripts from a CDN (sandboxed AI artifacts). One script tag, then <span data-ticker="AAPL">. Original square SVG tiles from logoapi.sh, light and dark. No API key.
Maintainers
Readme
logoapi-script
Stock and crypto logos for pages that can only load scripts from a CDN, such as sandboxed AI artifacts where fetch() and outside images are blocked. One script tag, then one <span> per ticker.
<script src="https://cdn.jsdelivr.net/npm/[email protected]/logo.js"></script>
<span data-ticker="AAPL"></span>
<span data-ticker="BTC" data-size="32"></span>
<span data-ticker="NVDA" data-theme="dark"></span>The loader reads its own URL and loads one small script per ticker from the same version, for example [email protected]/t/AAPL.js or t/dark/AAPL.js. Each file holds the original square SVG tile served by https://logoapi.sh/ticker/AAPL.svg?shape=square&fallback=404 (dark: /dark/ticker/...), byte for byte. Where that answer is a wordmark too small to read in a tile, and the brand's own favicon is sharp and stands out on that theme's plate, the file holds the tile from ?shape=square instead (also byte for byte); t/list.json lists those files under favicon (as t/SYM and t/dark/SYM). Tickers rendered later by React or other code are picked up too.
| Attribute | Default | Notes |
| --- | --- | --- |
| data-ticker | required | Stock, ETF or coin symbol, any case. BRK.B, BRK-B and NASDAQ:AAPL work. Put it on an empty element; one that holds anything else is left alone |
| data-logoapi | | Same as data-ticker, for pages that already use data-ticker for their own rows. Wins when both are set |
| data-size | 48 | Width and height in px |
| data-theme | light | dark for dark backgrounds. Set data-theme="dark" on the script tag to make dark the page default |
A ticker with no catalog logo in this version shows a letter tile, sized and centred like a logo. The loader never swaps in a logo from another source. t/list.json lists every ticker in the version.
Pin an exact version, as above. Logos added to the catalog later arrive in later versions.
Logos are trademarks of their owners. See https://logoapi.sh/terms. Code: MIT.
