Fast handcraft svg badge generator library . Used on badgen.net.
 
 
Go to file
Jacob Müller a338c832ee chore: add license and improve readme 2018-08-08 22:05:01 +02:00
bench chore: add bench for icon support 2018-07-20 15:51:12 +08:00
lib feat: slightly tweak subject position 2018-08-06 19:26:14 +08:00
preview chore: update tests 2018-07-20 15:45:45 +08:00
tap-snapshots test: snap tests 2018-08-06 19:28:42 +08:00
test test: update tests 2018-08-06 15:25:01 +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
LICENSE.md chore: add license and improve readme 2018-08-08 22:05:01 +02:00
README.md chore: add license and improve readme 2018-08-08 22:05:01 +02:00
package-lock.json 2.2.2 2018-08-06 19:29:29 +08:00
package.json 2.2.2 2018-08-06 19:29:29 +08:00

README.md

Badgen

npm version Coverage Status Install size License

Fast handcraft svg badge generator. Used on badgen.net.

Usage

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
  iconWidth: 13     // Use this if icon is not square.
})

Available color names:

Benchmarks

npm run bench on my iMac5K(Late 2014), 3.5G i5, with Node.js 10.5.0:

[classic] style, long params x 742,904 ops/sec ±0.92% (88 runs sampled)
[classic] style, full params x 998,716 ops/sec ±0.78% (93 runs sampled)
   [flat] style, long params x 618,005 ops/sec ±0.77% (92 runs sampled)
   [flat] style, full params x 677,415 ops/sec ±0.67% (93 runs sampled)
[classic] style, with emoji  x 502,203 ops/sec ±2.11% (91 runs sampled)
[classic] style, with icon   x 844,518 ops/sec ±1.10% (94 runs sampled)