8000 shields/gh-badges at ts · gavinuhma/shields · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
 
 

gh-badges

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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.
0