kopia lustrzana https://github.com/badgen/badgen
903860f6db | ||
---|---|---|
bench | ||
lib | ||
preview | ||
tap-snapshots | ||
test | ||
.gitignore | ||
.npmignore | ||
.travis.yml | ||
README.md | ||
package-lock.json | ||
package.json |
README.md
badgen
Fast handcraft svg badge generator.
- 🌀 1 dependency (unicode-astral-regex)
- ⚡️ Fast by design (see benchmarks)
- 👯 Pure JavaScript, running in node & browser
Usage
npm package
npm install badgen
const badgen = require('badgen')
const svgString = badgen({
subject: 'npm', // <Text>
status: 'v1.2.3', // <Text>
color: 'blue', // <Color RGB> or <Color Name>, optional
style: 'flat', // 'flat' or undefined, optional
emoji: true, // Support emoji in text, optional
icon: 'data:image/svg+xml;base64,PHN2Zy...' // Use icon, optional
})
Available color names:
Badge As A Service
Benchmarks
npm run bench
on my iMac5K(Late 2014), 3.5G i5, with Node.js 10.5.0:
[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)