README
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.
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
default 90 nameWidth
The width of the left side of the shield
default 40 valueWidth
The width of the right side of the shield
default "#555" nameBgColor
The background color of the right side of the shield, commonly a neutral color, like gray
default "#4b1" valueBgColor
The background color of the right side of the shield, commonly an indicator color, like red or green
default "" name
The text on the left side of the shield
default "" value
The text on the right side of the shield
default "sans-serif" fontFamily
The font that should be used for badge text
default 11 fontSize
The size of the badge text, values are bounded to min: 8, max: 17
default 5 radius
The size of the chamfer of the badge, values are bounded to min: 0, max: 10
License
MIT