Fast handcraft svg badge generator library . Used on badgen.net.
 
 
Go to file
Amio 7669a174d6 2.1.2 2018-07-25 16:00:20 +08:00
bench chore: add bench for icon support 2018-07-20 15:51:12 +08:00
lib chore: slightly increase width for unicode & "@" 2018-07-25 15:58:22 +08:00
preview chore: update tests 2018-07-20 15:45:45 +08:00
tap-snapshots chore: slightly increase width for unicode & "@" 2018-07-25 15:58:22 +08:00
test chore: update tests for type checking 2018-07-25 11:30:09 +08:00
.gitignore Add test coverage report 2018-07-18 14:11:11 +08:00
.npmignore Update .npmignore 2018-07-19 14:21:31 +08:00
.travis.yml Revert "Add codecov report to travis.yml" 2018-07-18 15:18:35 +08:00
README.md chore: update docs in readme 2018-07-20 16:30:13 +08:00
package-lock.json 2.1.2 2018-07-25 16:00:20 +08:00
package.json 2.1.2 2018-07-25 16:00:20 +08:00

README.md

badgen

npm version install size Coverage Status

Fast handcraft svg badge generator.

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 Service

https://badgen.now.sh/

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)

License

ISC