theme option, so the fix is to request the version that matches your background and switch between the two when your app’s theme changes.
Which theme to request
Thetheme value names the color of the logo rather than the color of the background, which is the opposite of what many people expect, so a dark page needs theme/light:
theme returns the version made for light backgrounds, so existing logo URLs only need a change where they sit on a dark surface.
Follow the system theme
When your site follows the visitor’s operating system setting, a<picture> element does the switching without any JavaScript. The browser requests only the version that matches, and it swaps the image as soon as the system theme changes:
h/64 for a 32-pixel logo here, so the logo stays sharp on high-density screens.
Follow your app’s theme toggle
Apps with their own light and dark switch usually mark the theme with a class on the<html> element, and a <picture> media query can’t see that class because it only reads the system setting. The simplest approach in that case is to render both versions and let CSS show the right one:
dark:hidden on the first image and hidden dark:inline on the second. Hiding an image with CSS doesn’t stop the browser from downloading it, so every logo costs two requests this way. For long lists, pick a single URL from your theme state instead, as the component in the next section does.
When a brand has no light version
Most well-known brands have both versions, but some only have one, and Plausible and ING, for example, have no light logo at the time of writing. A request for a version that doesn’t exist returns the default fallback, which is the Brandfetch logo, so check whether the light version exists before deciding which URL to render. The Brand API answers that question in one request. Itslogos array lists every logo the brand has along with its theme, where light marks a logo made for dark backgrounds, so a brand has a light version when one of its logo entries has that theme. The Brand API needs your secret key, so make the call on your server, and since a brand’s logos rarely change, store the result with the company record or cache it rather than calling on every page view:
brand.ts
hasLight and from dark, which comes from whatever holds your theme, such as resolvedTheme === "dark" from next-themes:
BrandLogo.tsx
brightness-0 invert. If you don’t use the Brand API, adding fallback/404 to the theme/light URL makes the request fail when that version is missing, which you can catch with the image’s onError handler, though the logo then has to load once before your page knows which version to show.
Icons in dark mode
Where a logo only needs to identify the company, as in a list, a table, or an avatar, the squareicon type avoids the problem altogether. Icons are the images brands use as profile pictures, so they usually come with their own background color and read clearly on light and dark pages alike, and a slightly rounded corner helps them sit on either surface:
FAQ
How do I show a company logo on a dark background?
How do I show a company logo on a dark background?
Add
theme/light to the Logo API URL, as in https://cdn.brandfetch.io/domain/nike.com/theme/light/logo?c=BRANDFETCH_CLIENT_ID, which returns the version of the logo made for dark backgrounds.What's the difference between theme/light and theme/dark?
What's the difference between theme/light and theme/dark?
The value describes the logo, not the background.
theme/dark is a dark logo for light backgrounds, and theme/light is a light logo for dark backgrounds.Why does the Brandfetch logo show up instead of the company's logo in dark mode?
Why does the Brandfetch logo show up instead of the company's logo in dark mode?
The brand has no light version, so the request returned the default fallback. Check the Brand API’s
logos array for a logo with theme: "light" before rendering, and when there isn’t one, show the regular logo turned white with filter: brightness(0) invert(1), as in the component above.How do I switch logos when the user changes theme?
How do I switch logos when the user changes theme?
Use a
<picture> element with a prefers-color-scheme: dark source when your site follows the system setting. When your app has its own theme toggle, pick the URL from your theme state, or render both versions and hide one with CSS.Can I get a white version of a company logo?
Can I get a white version of a company logo?
For most brands, yes.
theme/light returns the version for dark backgrounds, which for most wordmarks is all white. A few brands don’t have one, and the Brand API’s logos array tells you when that’s the case. For those, a CSS filter can turn the regular logo white, though it flattens multicolor logos, so use it only as a fallback.Related
Logo API parameters
Theme, type, size, and fallback options for every logo URL
Logo walls
Customer and partner logo grids that work in both themes