{"id":16608,"library":"cliqz-logo-database","title":"Cliqz Logo Database","description":"cliqz-logo-database is a JavaScript library providing programmatic access to a curated, local database of company and brand logos. It enables developers to retrieve a logo's URL and primary color information based on a given website URL. Currently at version 0.7.0, it ships with TypeScript types, facilitating its integration into modern TypeScript projects. The library's primary differentiator is its ability to offer an offline-first lookup for logos, circumventing the need for external API calls for recognized brands. It supports both ESM and CommonJS import patterns, offering flexibility across various JavaScript environments. While stable at its current version, being pre-1.0 suggests the API might evolve in future major releases, although active development status beyond maintenance is not explicitly stated.","status":"active","version":"0.7.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install cliqz-logo-database","lang":"bash","label":"npm"},{"cmd":"yarn add cliqz-logo-database","lang":"bash","label":"yarn"},{"cmd":"pnpm add cliqz-logo-database","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary `getLogo` function is exported as a default export in ESM. Attempting to destructure it as a named export will fail.","wrong":"import { getLogo } from 'cliqz-logo-database';","symbol":"getLogo","correct":"import getLogo from 'cliqz-logo-database';"},{"note":"When using CommonJS `require()`, the default export is accessed via the `.default` property of the imported module object.","wrong":"const getLogo = require('cliqz-logo-database');","symbol":"getLogo (CommonJS)","correct":"const getLogo = require('cliqz-logo-database').default;"},{"note":"Import the `Logo` interface for type-checking the returned object if using TypeScript, although it's an inline type.","symbol":"Logo (Type)","correct":"import type { Logo } from 'cliqz-logo-database';"}],"quickstart":{"code":"import getLogo from 'cliqz-logo-database';\n\ninterface CliqzLogo {\n  color: string;\n  url: string;\n}\n\nfunction retrieveAndDisplayLogo(targetUrl: string): void {\n  console.log(`Attempting to retrieve logo for: ${targetUrl}`);\n  const logo: CliqzLogo | null = getLogo(targetUrl);\n\n  if (logo) {\n    console.log(`  Found logo!`);\n    console.log(`    URL: ${logo.url}`);\n    console.log(`    Primary Color: #${logo.color}`);\n    // In a browser environment, you might embed it like this:\n    // const img = document.createElement('img');\n    // img.src = logo.url;\n    // img.alt = `Logo for ${targetUrl}`;\n    // document.body.appendChild(img);\n  } else {\n    console.warn(`  No logo found in the database for ${targetUrl}.`);\n  }\n}\n\nretrieveAndDisplayLogo('https://cliqz.com');\nretrieveAndDisplayLogo('https://github.com');\nretrieveAndDisplayLogo('https://www.typescriptlang.org');\nretrieveAndDisplayLogo('https://an-unknown-website.xyz');","lang":"typescript","description":"This quickstart demonstrates how to import and use the `getLogo` function to fetch logo information for various URLs. It includes type safety for the `Logo` object and handles cases where no logo is found, logging the details to the console."},"warnings":[{"fix":"Always check the release notes before upgrading pre-1.0 versions. Pin exact versions in production environments.","message":"As the library is currently at version 0.7.0 (pre-1.0), the API surface is subject to change without adherence to semantic versioning for breaking changes. Developers should review release notes carefully when upgrading to new minor versions.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Be aware of potential data staleness. For frequently changing or very new brand logos, an external, real-time API might be necessary.","message":"The logo database is bundled directly with the package, meaning it represents a snapshot of logo data at the time of the package's release. It does not update in real-time. Newly launched websites or updated logos for existing sites may not be included until a new package version is released.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always check the return value of `getLogo` before accessing its properties, e.g., `if (logo) { /* use logo */ }`.","message":"The `getLogo` function returns `null` if a logo for the given URL is not found in its internal database. Failing to check for `null` can lead to `TypeError` when attempting to access properties like `logo.url` or `logo.color`.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Use `const getLogo = require('cliqz-logo-database').default;` for CommonJS environments.","cause":"Attempting to use `require('cliqz-logo-database')` directly as a function in CommonJS, without accessing the `.default` property.","error":"TypeError: getLogo is not a function"},{"fix":"Import `getLogo` as a default export: `import getLogo from 'cliqz-logo-database';`","cause":"Attempting to import `getLogo` as a named export (`import { getLogo } from 'cliqz-logo-database';`) when it is a default export.","error":"SyntaxError: The requested module 'cliqz-logo-database' does not provide an export named 'getLogo'"},{"fix":"Implement a null check: `const logo = getLogo(url); if (logo) { console.log(logo.url); } else { console.log('No logo found.'); }`","cause":"Accessing properties on the `logo` object without first checking if `getLogo()` returned `null` for an unknown URL.","error":"TypeError: Cannot read properties of null (reading 'url')"}],"ecosystem":"npm"}