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 09:54:52 +00:00
|
|
|
- 🌀 No dependeny.
|
|
|
|
- ⚡️ 200K+ ops on average. (see [benchamrks](#Benchmarks))
|
|
|
|
|
2018-05-30 03:13:32 +00:00
|
|
|
## Usage
|
|
|
|
|
2018-06-23 03:20:45 +00:00
|
|
|
### Badge Service
|
2018-05-30 03:13:32 +00:00
|
|
|
|
2018-06-22 17:20:48 +00:00
|
|
|
`https://badgen.now.sh/badge/:subject/:status/:color`
|
2018-05-30 03:13:32 +00:00
|
|
|
|
|
|
|
- `subject` Text
|
|
|
|
- `status` Text
|
2018-06-23 03:20:45 +00:00
|
|
|
- `color` Color RGB (default '3C1') or Color Preset (`green`, `yellow`, ...see below)
|
|
|
|
|
|
|
|
Color Presets:
|
|
|
|
|
|
|
|
![](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/grey/grey)
|
|
|
|
![](https://badgen.now.sh/badge/color/black/black)
|
|
|
|
|
|
|
|
Examples:
|
2018-05-30 03:13:32 +00:00
|
|
|
|
2018-06-22 17:20:48 +00:00
|
|
|
| Preview | URL |
|
|
|
|
| --- | --- |
|
|
|
|
|![](https://badgen.now.sh/badge/build/passing) | https://badgen.now.sh/badge/build/passing |
|
2018-06-23 11:41:52 +00:00
|
|
|
|![](https://badgen.now.sh/badge/stars/★★★★☆) | https://badgen.now.sh/badge/stars/★★★★☆ |
|
2018-06-22 17:20:48 +00:00
|
|
|
|![](https://badgen.now.sh/badge/style/standard/f2a) | https://badgen.now.sh/badge/style/standard/f2a |
|
2018-06-23 03:20:45 +00:00
|
|
|
|![](https://badgen.now.sh/badge/license/Apache-2.0/blue) | https://badgen.now.sh/badge/license/Apache-2.0/blue |
|
2018-06-23 08:51:51 +00:00
|
|
|
|![](https://badgen.now.sh/list/platform/ios,macos,tvos/grey) | https://badgen.now.sh/list/platform/ios,macos,tvos/grey |
|
2018-06-23 03:20:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
### Programmatically
|
|
|
|
|
|
|
|
`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({
|
|
|
|
subject: 'npm',
|
|
|
|
status: 'v1.2.3',
|
|
|
|
color: 'blue'
|
|
|
|
})
|
|
|
|
```
|
2018-06-22 17:20:48 +00:00
|
|
|
|
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
|
|
|
|
generate by short params x 420,831 ops/sec ±1.03% (87 runs sampled)
|
|
|
|
generate by long params x 167,862 ops/sec ±1.21% (90 runs sampled)
|
|
|
|
generate by full params x 245,303 ops/sec ±1.48% (92 runs sampled)
|
|
|
|
```
|
|
|
|
|
2018-06-22 17:20:48 +00:00
|
|
|
## License
|
|
|
|
|
2018-06-23 09:10:07 +00:00
|
|
|
ISC @ Amio
|
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
|