Fast handcraft svg badge generator library . Used on badgen.net.
 
 
Go to file
Amio 50bbe0d49f Update examples 2018-06-23 19:41:52 +08:00
bench Simplify benchmarks 2018-06-23 17:59:12 +08:00
lib Fix width calc with unicode 2018-06-23 19:39:25 +08:00
test Add lint & test 2018-06-23 00:35:29 +08:00
.gitignore Initial commit 2018-05-29 16:53:54 +08:00
.npmignore Add .npmignore 2018-06-23 00:37:11 +08:00
README.md Update examples 2018-06-23 19:41:52 +08:00
now.json Fix deploy errors 2018-06-23 00:57:26 +08:00
package-lock.json Add benchmark 2018-06-23 17:54:52 +08:00
package.json Add benchmark 2018-06-23 17:54:52 +08:00
service.js Add /list/ routes to service 2018-06-23 16:51:51 +08:00

README.md

badgen npm-version install size

Fast, handcraft, pure JavaScript badge generator.

  • 🌀 No dependeny.
  • 200K+ ops on average. (see benchamrks)

Usage

Badge Service

https://badgen.now.sh/badge/:subject/:status/:color

  • subject Text
  • status Text
  • color Color RGB (default '3C1') or Color Preset (green, yellow, ...see below)

Color Presets:

Examples:

Preview URL
https://badgen.now.sh/badge/build/passing
https://badgen.now.sh/badge/stars/★★★★☆
https://badgen.now.sh/badge/style/standard/f2a
https://badgen.now.sh/badge/license/Apache-2.0/blue
https://badgen.now.sh/list/platform/ios,macos,tvos/grey

Programmatically

npm install badgen

const badgen = require('badgen')

const svgString = badgen({
  subject: 'npm',
  status: 'v1.2.3',
  color: 'blue'
})

Benchmarks

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

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)

License

ISC @ Amio