Skip to content

Files

Latest commit

883b025 · Jul 23, 2019

History

History
This branch is 4059 commits behind badges/shields:master.

gh-badges

gh-badges

npm version npm license

Installation

npm install gh-badges

Usage

On the console

npm install -g gh-badges
badge build passed :green .png > mybadge.png

As a library

const { BadgeFactory } = require('gh-badges')

const bf = new BadgeFactory()

const format = {
  text: ['build', 'passed'],
  color: 'green',
  template: 'flat',
}

const svg = bf.create(format)

Node version support

The latest version of gh-badges supports all currently maintained Node versions. See the Node Release Schedule.

Format

The format is the following:

{
  text: [ 'build', 'passed' ],  // Textual information shown, in order

  format: 'svg',  // Also supports json

  color: '#4c1',
  labelColor: '#555',

  // See templates/ for a list of available templates.
  // Each offers a different visual design.
  template: 'flat',

  // Deprecated attributes:
  colorscheme: 'green', // Now an alias for `color`.
  colorB: '#4c1', // Now an alias for `color`.
  colorA: '#555', // Now an alias for `labelColor`.
}

See also

Colors

There are three ways to specify color and labelColor:

  1. One of the Shields named colors:
  • – the default labelColor

  • – the default color

  • – the default color

  1. A three- or six-character hex color, optionally prefixed with #:
  • etc.
  1. Any valid CSS color, e.g.
  • rgb(...), rgba(...)
  • hsl(...), hsla(...)
  • etc.