badgen
![License](https://badgen.net/github/license/amio/badgen)
Fast handcraft svg badge generator. Used on badgen.net.
- 🌀 Zero dependency
- ⚡️ Fast by design (see benchmarks)
- 👯 Running in node & browser
Usage
npm install badgen
const { badgen } = require('badgen')
const svgString = badgen({
label: 'npm',
labelColor: 'ADF',
status: 'v1.2.3',
color: 'blue',
style: 'flat',
icon: 'data:image/svg+xml;base64,...',
iconWidth: 13,
scale: 1
})
Available color names:
![](https://badgen.net/badge/color/black/black)
In browser
<script src="https://unpkg.com/badgen"></script>
<script>
var svgString = badgen({ })
</script>
Benchmarks
npm run bench
on iMac 5K (Late 2014), 3.5G i5, with Node.js 12.11.0:
[classic] style, long params x 985,898 ops/sec ±0.37% (94 runs sampled)
[classic] style, full params x 1,284,886 ops/sec ±0.42% (95 runs sampled)
[classic] style, with emoji x 1,291,768 ops/sec ±0.28% (95 runs sampled)
[classic] style, with icon x 1,177,120 ops/sec ±0.94% (95 runs sampled)
[flat] style, long params x 780,504 ops/sec ±0.39% (94 runs sampled)
[flat] style, full params x 1,012,111 ops/sec ±0.40% (97 runs sampled)
[flat] style, with emoji x 1,013,695 ops/sec ±0.91% (95 runs sampled)
[flat] style, with icon x 994,481 ops/sec ±0.30% (94 runs sampled)
See Also