mirror of
https://github.com/simple-icons/simple-icons.git
synced 2025-01-05 01:20:39 +02:00
readme: Update example icons to be that of Simple Icons (#1174)
This commit is contained in:
parent
a853febf3f
commit
18dd9a2d6b
32
README.md
32
README.md
@ -18,8 +18,15 @@ Icons can be downloaded as SVGs directly from [our website](https://simpleicons.
|
||||
Icons can be served from a CDN such as [JSDelivr](https://www.jsdelivr.com/package/npm/simple-icons) or [Unpkg](https://unpkg.com). Simply use the `simple-icons` npm package and specify a version in the URL like the following:
|
||||
|
||||
```html
|
||||
<img height="32" width="32" src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/stackoverflow.svg" />
|
||||
<img height="32" width="32" src="https://unpkg.com/simple-icons@latest/icons/stackoverflow.svg" />
|
||||
<img height="32" width="32" src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/[ICON NAME].svg" />
|
||||
<img height="32" width="32" src="https://unpkg.com/simple-icons@latest/icons/[ICON NAME].svg" />
|
||||
```
|
||||
|
||||
Where `[ICON NAME]` is replaced by the icon name, for example:
|
||||
|
||||
```html
|
||||
<img height="32" width="32" src="https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/simpleicons.svg" />
|
||||
<img height="32" width="32" src="https://unpkg.com/simple-icons@latest/icons/simpleicons.svg" />
|
||||
```
|
||||
|
||||
### Node Usage
|
||||
@ -35,13 +42,13 @@ The API can then be used as follows:
|
||||
```javascript
|
||||
const simpleIcons = require('simple-icons');
|
||||
|
||||
console.log(simpleIcons['Google+']);
|
||||
console.log(simpleIcons['Simple Icons']);
|
||||
|
||||
/*
|
||||
{
|
||||
title: 'Google+',
|
||||
hex: 'DC4E41',
|
||||
source: 'https://developers.google.com/+/branding-guidelines',
|
||||
title: 'Simple Icons',
|
||||
hex: '111111',
|
||||
source: 'https://simpleicons.org/',
|
||||
svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>'
|
||||
}
|
||||
*/
|
||||
@ -50,15 +57,16 @@ console.log(simpleIcons['Google+']);
|
||||
Alternatively you can import the needed icons individually.
|
||||
This is useful if you are e.g. compiling your code with [webpack](https://webpack.js.org/) and therefore have to be mindful of your package size:
|
||||
|
||||
```js
|
||||
const googleplus = require('simple-icons/icons/googleplus');
|
||||
```javascript
|
||||
const icon = require('simple-icons/icons/simpleicons');
|
||||
|
||||
console.log(icon);
|
||||
|
||||
console.log(googleplus);
|
||||
/*
|
||||
{
|
||||
title: 'Google+',
|
||||
hex: 'DC4E41',
|
||||
source: 'https://developers.google.com/+/branding-guidelines',
|
||||
title: 'Simple Icons',
|
||||
hex: '111111',
|
||||
source: 'https://simpleicons.org/',
|
||||
svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>'
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user