Skip to content
Documentation Menu

Using the Package

Logos

Finmarks tracks multiple logo variants per entity. Every URL returned by the API resolves — the index only lists variants that actually exist on disk at build time, so you never need to handle a 404.

Variants

fullSymbol + wordmark. The primary logo. Use this as the default.
iconSymbol only. Square or near-square. Good for avatars and small sizes.
mono_darkSingle colour, for placement on dark backgrounds.
mono_lightSingle colour, for placement on light backgrounds.

getLogoUrl

Returns the CDN URL for a single variant, or undefined if the entity is unknown or that variant has not been sourced. Defaults to 'full'.

function getLogoUrl(id: string, variant?: LogoVariant): string | undefined
import { getLogoUrl } from '@finmarks/finmarks';

getLogoUrl('hdfc-bank');           // full logo (default)
getLogoUrl('hdfc-bank', 'icon');    // icon only
getLogoUrl('hdfc-bank', 'mono_dark'); // monochrome for dark bg
getLogoUrl('unknown-id');        // undefined

getLogoUrlWithFallback

Tries each variant in order and returns the first that exists. Use this when you want a specific variant but need to gracefully degrade.

function getLogoUrlWithFallback(id: string, variants?: LogoVariant[]): string | undefined
import { getLogoUrlWithFallback } from '@finmarks/finmarks';

// Prefer icon, fall back to the full logo
getLogoUrlWithFallback('phonepe', ['icon', 'full']);

// Default order: ['full', 'icon']
getLogoUrlWithFallback('phonepe');

getLogos

Returns an object with every available URL for an entity, keyed by variant. Returns a fresh object — mutating it does not affect the dataset.

function getLogos(id: string): LogoUrls
import { getLogos } from '@finmarks/finmarks';

const logos = getLogos('icici-bank');
// { full: '...', icon: '...', mono_dark: '...' }

Hotlinking without npm

Logo URLs follow a predictable pattern. You can construct them manually if you do not want to use the npm package at all:

https://cdn.jsdelivr.net/gh/Finmarks/Finmarks@main/entities/{id}/{variant}.svg

For example:

<img
  src="https://cdn.jsdelivr.net/gh/Finmarks/Finmarks@main/entities/phonepe/icon.svg"
  alt="PhonePe"
  width="32"
  height="32"
/>

Tip: Use buildLogoUrl(id, filename) to compose a URL without a dataset lookup, for cases where you already know the filename.