2018-07-18 07:38:59 +00:00
|
|
|
# badgen
|
|
|
|
|
|
|
|
[![npm-version][npm-badge]][npm-link]
|
|
|
|
[![install size][pp-badge]][pp-link]
|
2018-07-19 06:54:54 +00:00
|
|
|
[![Coverage Status][cr-badge]][cr-link]
|
2018-05-30 03:13:32 +00:00
|
|
|
|
|
|
|
Fast, handcraft, pure JavaScript badge generator.
|
|
|
|
|
2018-07-19 06:54:54 +00:00
|
|
|
- 🌀 1 dependency ([unicode-astral-regex][uar-link])
|
|
|
|
- ⚡️ Fast by design (see [benchmarks](#benchmarks))
|
|
|
|
- 👯 Pure JavaScript, running in node & browser
|
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>
|
2018-07-15 09:22:56 +00:00
|
|
|
color: 'blue' // <Color RGB> or <Color Name>, optional
|
2018-07-16 13:58:23 +00:00
|
|
|
style: 'flat' // 'flat' or undefined, optional
|
|
|
|
})
|
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:
|
|
|
|
|
2018-06-29 17:00:07 +00:00
|
|
|
![](https://badgen.now.sh/badge/color/blue/blue)
|
|
|
|
![](https://badgen.now.sh/badge/color/cyan/cyan)
|
2018-06-29 15:21:35 +00:00
|
|
|
![](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/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-07-15 09:22:56 +00:00
|
|
|
[classic] style, long params x 1,071,083 ops/sec ±0.82% (89 runs sampled)
|
|
|
|
[classic] style, full params x 1,332,181 ops/sec ±0.80% (92 runs sampled)
|
|
|
|
[flat] style, long params x 1,145,825 ops/sec ±0.73% (94 runs sampled)
|
|
|
|
[flat] style, full params x 1,416,453 ops/sec ±0.69% (91 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
|
|
|
|
2018-07-10 05:12:48 +00:00
|
|
|
[npm-badge]: https://badgen.now.sh/npm/v/badgen
|
2018-06-22 17:20:48 +00:00
|
|
|
[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-07-18 07:38:59 +00:00
|
|
|
[cr-badge]: https://coveralls.io/repos/github/amio/badgen/badge.svg?branch=master
|
|
|
|
[cr-link]: https://coveralls.io/github/amio/badgen?branch=master
|
2018-07-19 06:54:54 +00:00
|
|
|
[uar-link]: https://www.npmjs.com/package/unicode-astral-regex
|
2018-06-29 16:08:10 +00:00
|
|
|
[shields-io]: https://shields.io
|
|
|
|
[gh-badges-link]: https://www.npmjs.com/package/gh-badges
|