node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »


component badge Build Status

Based on @timoxley's idea and made for @ForbesLindesay's website

npm install component-badge

badge([count, [options]]) returns a String representing a SVG image.
count is the number shown under the logo ("1337 available"). If left out the subline comletely vanishes.
options is an object that takes these params including their default values.

  • scale: 1
  • subtitlePos: "bottom"
  • subtitleFill: "#939393"
  • backgroundFill: "none"
  • titleFill: "#000000"
  • circleFill: "#353535"
  • leftAnnulusFill: "#353535"
  • rightAnnulusFill: "#939393"

badge.load(path) loads a new template.
path is the path to the template to be loaded.

var badge = require("component-badge");
console.log(badge(1337, 1.5)); // <svg width="720px" height="180px">... 

Fun Fact: The vector graphic was generated by JavaScript.