1.0.0 • Published 7 years ago

quick-badge-generator v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

quick-badge-generator Build Status

A simple API to generate badges for your GitHub Projects!

Install

$ npm install --save quick-badge-generator

Usage

'use strict';

const qbg = require('quick-badge-generator');

qbg('build', 'passing', 'green');

/*
{
  default: 'https://img.shields.io/badge/build-passing-green.svg',
  plastic: 'https://img.shields.io/badge/build-passing-green.svg?style=plastic',
  flat: 'https://img.shields.io/badge/build-passing-green.svg?style=flat',
  flatSquared: 'https://img.shields.io/badge/build-passing-green.svg?style=flat-square',
  social: 'https://img.shields.io/badge/build-passing-green.svg?style=social'
}
*/

const prop = qbg('build', 'unkown', 'red');

console.log(prop.default);

// => https://img.shields.io/badge/build-failing-red.svg

API

The default parameter for status and color are optional as they are replaced by unknown and lightgrey respectively when the value aren't provided!

qbg('subject', 'status', 'color')

subject

TYPE : string

status

TYPE : string

color

TYPE : string

You can only use the following colors in your badge :

  • brightgree
  • green
  • yellowgreen
  • yellow
  • orange
  • red
  • lightgrey
  • blue

STYLES

There are four styles available :

  • plastic
  • flat
  • flatSquare
  • social

You can exract the required style using :

const styles = qbg('build', 'passing', 'green');

console.log(styles.plastic)
// => 'https://img.shields.io/badge/build-passing-green.svg?style=plastic'
console.log(styles.flat)
// => 'https://img.shields.io/badge/build-passing-green.svg?style=flat'
console.log(styles.flatSquare)
// => 'https://img.shields.io/badge/build-passing-green.svg?style=flat-square'
console.log(styles.social)
// => 'https://img.shields.io/badge/build-passing-green.svg?style=social'

Related

  • Quick Badge Link : Generate links to pixel-perfect, retina-ready, fast, and consistent badges for your projects!

License

MIT © Rishi Giri