UNPKG

6.9 kBMarkdownView Raw
1<p align="center">
2<a href="https://simpleicons.org/">
3<img src="https://simpleicons.org/icons/simpleicons.svg" alt="Simple Icons" width=64 height=64>
4</a>
5<h3 align="center">Simple Icons</h3>
6<p align="center">
7Over 2000 Free SVG icons for popular brands. See them all on one page at <a href="https://simpleicons.org">SimpleIcons.org</a>. Contributions, corrections & requests can be made on GitHub.</p>
8</p>
9
10<p align="center">
11<a href="https://github.com/simple-icons/simple-icons/actions?query=workflow%3AVerify+branch%3Adevelop"><img src="https://img.shields.io/github/workflow/status/simple-icons/simple-icons/Verify/develop?logo=github" alt="Build status" /></a>
12<a href="https://www.npmjs.com/package/simple-icons"><img src="https://img.shields.io/npm/v/simple-icons.svg?logo=npm" alt="NPM version" /></a>
13<a href="https://packagist.org/packages/simple-icons/simple-icons"><img src="https://img.shields.io/packagist/v/simple-icons/simple-icons?logo=packagist&logoColor=white" alt="Build status" /></a>
14</p>
15
16## Usage
17
18> :information_source: We ask that all users read our [legal disclaimer](./DISCLAIMER.md) before using icons from Simple Icons.
19
20### General Usage
21
22Icons can be downloaded as SVGs directly from [our website](https://simpleicons.org/) - simply click the icon you want, and the download should start automatically.
23
24### CDN Usage
25
26Icons can be served from a CDN such as [JSDelivr](https://www.jsdelivr.com/package/npm/simple-icons) or [Unpkg](https://unpkg.com/browse/simple-icons/). Simply use the `simple-icons` npm package and specify a version in the URL like the following:
27
28```html
29<img height="32" width="32" src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/[ICON SLUG].svg" />
30<img height="32" width="32" src="https://unpkg.com/simple-icons@v5/icons/[ICON SLUG].svg" />
31```
32
33Where `[ICON SLUG]` is replaced by the [slug] of the icon you want to use, for example:
34
35```html
36<img height="32" width="32" src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/simpleicons.svg" />
37<img height="32" width="32" src="https://unpkg.com/simple-icons@v5/icons/simpleicons.svg" />
38```
39
40These examples use the latest major version. This means you won't receive any updates following the next major release. You can use `@latest` instead to receive updates indefinitely. However, this will result in a `404` error if the icon is removed.
41
42### Node Usage
43
44The icons are also available through our npm package. To install, simply run:
45
46```shell
47npm install simple-icons
48```
49
50The API can then be used as follows, where `[ICON SLUG]` is replaced by a [slug]:
51
52```javascript
53const simpleIcons = require('simple-icons');
54
55// Get a specific icon by its slug as:
56// simpleIcons.Get('[ICON SLUG]');
57
58// For example:
59const icon = simpleIcons.Get('simpleicons');
60
61```
62
63Alternatively, you can also import all icons from a single file, where `[ICON SLUG]` is replaced by a capitalized [slug]. We highly recommend using a bundler that can tree shake such as [webpack](https://webpack.js.org/) to remove the unused icon code:
64```javascript
65// Import a specific icon by its slug as:
66// import { si[ICON SLUG] } from 'simple-icons/icons'
67
68// For example:
69// use import/esm to allow tree shaking
70import { siSimpleicons } from 'simple-icons/icons'
71```
72
73You can also import the needed icons individually, where `[ICON SLUG]` is replaced by a [slug].
74```javascript
75// Import a specific icon by its slug as:
76// require('simple-icons/icons/[ICON SLUG]');
77
78// For example:
79const icon = require('simple-icons/icons/simpleicons');
80```
81
82Either method will return an icon object:
83
84```javascript
85console.log(icon);
86
87/*
88{
89 title: 'Simple Icons',
90 slug: 'simpleicons',
91 hex: '111111',
92 source: 'https://simpleicons.org/',
93 svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>',
94 path: 'M12 12v-1.5c-2.484 ...',
95 guidelines: 'https://simpleicons.org/styleguide',
96 license: {
97 type: '...',
98 url: 'https://example.com/'
99 }
100}
101
102NOTE: the `guidelines` entry will be `undefined` if we do not yet have guidelines for the icon.
103NOTE: the `license` entry will be `undefined` if we do not yet have license data for the icon.
104*/
105```
106
107Lastly, the `simpleIcons` object is also enumerable.
108This is useful if you want to do a computation on every icon:
109
110```javascript
111const simpleIcons = require('simple-icons');
112
113for (const iconSlug in simpleIcons) {
114 const icon = simpleIcons.Get(iconSlug);
115 // do stuff
116}
117```
118
119#### TypeScript Usage
120
121Type definitions are bundled with the package.
122
123### PHP Usage
124
125The icons are also available through our Packagist package. To install, simply run:
126
127```shell
128composer require simple-icons/simple-icons
129```
130
131The package can then be used as follows, where `[ICON SLUG]` is replaced by a [slug]:
132
133```php
134<?php
135// Import a specific icon by its slug as:
136echo file_get_contents('path/to/package/icons/[ICON SLUG].svg');
137
138// For example:
139echo file_get_contents('path/to/package/icons/simpleicons.svg');
140
141// <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>
142?>
143```
144
145## Third-Party Extensions
146
147| Extension | Author |
148| :--- | :--- |
149| [Blender add-on](https://github.com/mondeja/simple-icons-blender) | [@mondeja](https://github.com/mondeja) |
150| [Drawio library](https://github.com/mondeja/simple-icons-drawio) | [@mondeja](https://github.com/mondeja) |
151| [Drupal module](https://www.drupal.org/project/simple_icons) | [Phil Wolstenholme](https://www.drupal.org/u/phil-wolstenholme) |
152| [Flutter package](https://pub.dev/packages/simple_icons) | [@jlnrrg](https://jlnrrg.github.io/) |
153| [Hexo plugin](https://github.com/nidbCN/hexo-simpleIcons) | [@nidbCN](https://github.com/nidbCN/) |
154| [Home Assistant plugin](https://github.com/vigonotion/hass-simpleicons) | [@vigonotion](https://github.com/vigonotion/) |
155| [Jetpack Compose library](https://github.com/DevSrSouza/compose-icons) | [@devsrsouza](https://github.com/devsrsouza/) |
156| [Kirby plugin](https://github.com/runxel/kirby3-simpleicons) | [@runxel](https://github.com/runxel) |
157| [Laravel Package](https://github.com/ublabs/blade-simple-icons) | [@adrian-ub](https://github.com/adrian-ub) |
158| [Python package](https://github.com/sachinraja/simple-icons-py) | [@sachinraja](https://github.com/sachinraja) |
159| [React package](https://github.com/icons-pack/react-simple-icons) | [@wootsbot](https://github.com/wootsbot) |
160| [Svelte package](https://github.com/icons-pack/svelte-simple-icons) | [@wootsbot](https://github.com/wootsbot) |
161| [Vue package](https://github.com/mainvest/vue-simple-icons) | [@noahlitvin](https://github.com/noahlitvin) |
162| [WordPress plugin](https://wordpress.org/plugins/simple-icons/) | [@tjtaylo](https://github.com/tjtaylo) |
163
164[slug]: ./slugs.md
165
166## Contribute
167
168Information describing how to contribute can be found here:
169
170https://github.com/simple-icons/simple-icons/blob/develop/CONTRIBUTING.md