Naughty Platypus Memorabilia
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

svg-shield

2.0.0 • Public • Published

svg-shield

SVG shields (badges) for node with custom text, colors, and widths.

These SVGs show how you can customize the text, both colors, and the width of each side.

Sample Shield

Sample Shield

These SVGs are based on those used by shields.io.

Install

npm install svg-shield --save

API

var shield = require( "svg-shield" );
var options = { name: "name", value: "value" }; // see Options section
shield.getShield( options, function ( err, svg ) {
    // do something with svg now, for example with Express
    return res.type( "image/svg+xml" ).send( svg );
}

Options

nameWidth default 90

The width of the left side of the shield

valueWidth default 40

The width of the right side of the shield

nameBgColor default "#555"

The background color of the right side of the shield, commonly a neutral color, like gray

valueBgColor default "#4b1"

The background color of the right side of the shield, commonly an indicator color, like red or green

name default ""

The text on the left side of the shield

value default ""

The text on the right side of the shield

fontFamily default "sans-serif"

The font that should be used for badge text

fontSize default 11

The size of the badge text, values are bounded to min: 8, max: 17

radius default 5

The size of the chamfer of the badge, values are bounded to min: 0, max: 10

License

MIT

Keywords

none

install

npm i svg-shield

Downloadsweekly downloads

5

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability