https://github.com/codedotjs/quick-badge-generator
:boom: A simple API to generate badges for your GitHub Projects!
https://github.com/codedotjs/quick-badge-generator
api badge badge-generator generator nodejs quick
Last synced: 3 months ago
JSON representation
:boom: A simple API to generate badges for your GitHub Projects!
- Host: GitHub
- URL: https://github.com/codedotjs/quick-badge-generator
- Owner: CodeDotJS
- License: mit
- Created: 2017-07-25T04:31:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-28T06:12:52.000Z (over 8 years ago)
- Last Synced: 2025-06-11T20:36:53.452Z (5 months ago)
- Topics: api, badge, badge-generator, generator, nodejs, quick
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
## quick-badge-generator [](https://travis-ci.org/CodeDotJS/quick-badge-generator)
> A simple API to generate badges for your GitHub Projects!
## Install
```
$ npm install --save quick-badge-generator
```
## Usage
```js
'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 :`
```js
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`](https://github.com/CodeDotJS/quick-badge-link)__ : `Generate links to pixel-perfect, retina-ready, fast, and consistent badges for your projects!`
## License
MIT © [Rishi Giri](http://rishigiri.ml)