2018-06-22 17:20:48 +00:00
|
|
|
# badgen [![npm-version][npm-badge]][npm-link] [![install size][pp-badge]][pp-link]
|
2018-05-30 03:13:32 +00:00
|
|
|
|
|
|
|
Fast, handcraft, pure JavaScript badge generator.
|
|
|
|
|
2018-06-23 12:03:08 +00:00
|
|
|
- ⚡️ Fast (see [benchamrks](#benchmarks))
|
2018-06-29 16:08:10 +00:00
|
|
|
- 🌀 Zero dependency (compare with 11 deps for [gh-badges][gh-badges-link] which being used on [shields.io][shields-io])
|
2018-06-23 09:54:52 +00:00
|
|
|
|
2018-05-30 03:13:32 +00:00
|
|
|
## Usage
|
|
|
|
|
2018-06-26 06:57:57 +00:00
|
|
|
### npm package
|
2018-06-23 03:20:45 +00:00
|
|
|
|
|
|
|
`npm install badgen`
|
2018-05-30 03:13:32 +00:00
|
|
|
|
2018-06-23 03:20:45 +00:00
|
|
|
```javascript
|
|
|
|
const badgen = require('badgen')
|
2018-05-30 03:13:32 +00:00
|
|
|
|
2018-06-23 03:20:45 +00:00
|
|
|
const svgString = badgen({
|
2018-06-29 15:21:35 +00:00
|
|
|
subject: 'npm', // <Text>
|
|
|
|
status: 'v1.2.3', // <Text>
|
|
|
|
color: 'blue' // <Color RGB> or <Color Name>
|
2018-06-23 03:20:45 +00:00
|
|
|
})
|
|
|
|
```
|
2018-06-22 17:20:48 +00:00
|
|
|
|
2018-06-29 15:21:35 +00:00
|
|
|
Available color names:
|
|
|
|
|
|
|
|
![](https://badgen.now.sh/badge/color/green/green)
|
|
|
|
![](https://badgen.now.sh/badge/color/yellow/yellow)
|
|
|
|
![](https://badgen.now.sh/badge/color/orange/orange)
|
|
|
|
![](https://badgen.now.sh/badge/color/red/red)
|
|
|
|
![](https://badgen.now.sh/badge/color/pink/pink)
|
|
|
|
![](https://badgen.now.sh/badge/color/purple/purple)
|
|
|
|
![](https://badgen.now.sh/badge/color/blue/blue)
|
|
|
|
![](https://badgen.now.sh/badge/color/cyan/cyan)
|
|
|
|
![](https://badgen.now.sh/badge/color/grey/grey)
|
|
|
|
|
2018-06-26 06:57:57 +00:00
|
|
|
### Badge Service
|
|
|
|
|
|
|
|
https://badgen.now.sh/
|
|
|
|
|
2018-06-23 09:54:52 +00:00
|
|
|
## Benchmarks
|
|
|
|
|
2018-06-23 10:01:51 +00:00
|
|
|
`npm run bench` on my iMac5K(Late 2014), 3.5G i5, with Node.js 10.5.0:
|
2018-06-23 09:54:52 +00:00
|
|
|
|
|
|
|
```bash
|
2018-06-29 13:41:26 +00:00
|
|
|
generate by short params x 543,857 ops/sec ±0.98% (90 runs sampled)
|
|
|
|
generate by long params x 512,747 ops/sec ±0.66% (91 runs sampled)
|
|
|
|
generate by full params x 461,409 ops/sec ±0.78% (90 runs sampled)
|
2018-06-23 09:54:52 +00:00
|
|
|
```
|
|
|
|
|
2018-06-22 17:20:48 +00:00
|
|
|
## License
|
|
|
|
|
2018-06-23 12:03:08 +00:00
|
|
|
![ISC](https://badgen.now.sh/badge/license/ISC/blue)
|
2018-06-22 17:20:48 +00:00
|
|
|
|
|
|
|
[npm-badge]: https://img.shields.io/npm/v/badgen.svg
|
|
|
|
[npm-link]: https://www.npmjs.com/package/badgen
|
|
|
|
[pp-badge]: https://packagephobia.now.sh/badge?p=badgen
|
|
|
|
[pp-link]: https://packagephobia.now.sh/result?p=badgen
|
2018-06-29 16:08:10 +00:00
|
|
|
[shields-io]: https://shields.io
|
|
|
|
[gh-badges-link]: https://www.npmjs.com/package/gh-badges
|