Socket
Socket
Sign inDemoInstall

badgen

Package Overview
Dependencies
0
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    badgen

Fast svg badge generator.


Version published
Maintainers
1
Install size
46.9 kB
Created

Readme

Source

badgen

npm version Coverage Status Install size License

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

  • 🌀 Zero dependency
  • ⚡️ Fast by design (see benchmarks)
  • 👯‍ Pure JavaScript, running in node & browser

Usage

npm install badgen

const badgen = require('badgen')

// only `status` is required.
const svgString = badgen({
  label: 'npm',     // <Text>
  labelColor: 'ADF' // <Color RGB> or <Color Name> (default 555)
  status: 'v1.2.3', // <Text>, required
  color: 'blue',    // <Color RGB> or <Color Name> (default blue)
  style: 'flat',    // 'flat' or undefined
  icon: 'data:image/svg+xml;base64,...', // Use icon
  iconWidth: 13,    // Set this if icon is not square
})

Available color names:

In browser

<script src="https://wzrd.in/standalone/badgen@latest"></script>
<script>
  var svgString = badgen({ /*...*/ })
</script>

Benchmarks

npm run bench on my MacBook Pro (Early 2015), 2.7G i5, with Node.js 10.9.0:

[classic] style, long params x 784,111 ops/sec ±1.53% (89 runs sampled)
[classic] style, full params x 1,096,667 ops/sec ±1.37% (90 runs sampled)
[classic] style, with emoji  x 1,086,230 ops/sec ±1.85% (92 runs sampled)
[classic] style, with icon   x 941,914 ops/sec ±0.41% (93 runs sampled)
   [flat] style, long params x 546,447 ops/sec ±0.52% (91 runs sampled)
   [flat] style, full params x 612,977 ops/sec ±1.08% (94 runs sampled)
   [flat] style, with emoji  x 620,193 ops/sec ±0.95% (92 runs sampled)
   [flat] style, with icon   x 566,848 ops/sec ±0.84% (93 runs sampled)

See Also

FAQs

Last updated on 06 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc