very-simple-icons
v1.0.0
Published
Map npm package names to simple-icons icons
Downloads
248
Maintainers
Readme
very-simple-icons
Map npm package names to simple-icons icons. Handles scoped packages, hyphenated names, and version suffixes automatically.
Install
npm install very-simple-icons simple-icons
simple-iconsis a peer dependency — install it separately to always get the latest icons.
Usage
import { getIcon } from 'very-simple-icons'
getIcon('react') // → React icon
getIcon('react-dom') // → React icon
getIcon('@tanstack/react-query') // → TanStack icon
getIcon('@angular/core') // → Angular icon
getIcon('typescript') // → TypeScript icon
getIcon('node') // → Node.js icon
getIcon('react@18') // → React icon (version stripped)
getIcon('unknown-pkg') // → undefinedThe returned object is the native SimpleIcon from simple-icons:
{
title: 'React',
slug: 'react',
hex: '61DAFB', // brand color, no #
svg: '<svg .../>', // full SVG markup
path: 'M...', // SVG path data
source: 'https://react.dev',
guidelines?: string,
license?: { type: string, url: string }
}Normalization rules
| Input | Slug tried | Result |
|---|---|---|
| react | react | React |
| react-dom | override → react | React |
| @tanstack/react-query | tanstack, react-query, reactquery | TanStack |
| @angular/core | angular, core | Angular |
| node | override → nodedotjs | Node.js |
| react@18 | react | React |
For scoped packages (@scope/pkg), the scope is tried first. This means @tanstack/* always resolves to the TanStack icon regardless of the sub-package.
API
getIcon(packageName: string): SimpleIcon | undefined
Returns the matching SimpleIcon or undefined if no icon is found.
normalizePackageName(packageName: string): string[]
Returns the ordered list of slug candidates that getIcon tries internally. Useful for debugging or building custom lookup logic.
import { normalizePackageName } from 'very-simple-icons'
normalizePackageName('@tanstack/react-query')
// → ['tanstack', 'react-query', 'reactquery']Why peerDependency?
simple-icons ships over 3,400 icons and releases frequently. Declaring it as a peer dependency means you can run npm install simple-icons@latest at any time to get new icons without waiting for a new release of this library.
License
MIT © ElJijuna
