* Build(deps): bump css-color-converter in /badge-maker Bumps [css-color-converter](https://github.com/andyjansson/css-color-converter) from 1.1.1 to 2.0.0. - [Release notes](https://github.com/andyjansson/css-color-converter/releases) - [Changelog](https://github.com/andyjansson/css-color-converter/blob/master/CHANGELOG.md) - [Commits](https://github.com/andyjansson/css-color-converter/commits) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Update implementation and package-lock.json * Fix some URLs which switched to HTTP Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: PyvesB <PyvesDev@gmail.com>
badge-maker
Installation
npm install badge-maker
Usage
On the console
npm install -g badge-maker
badge build passed :green > mybadge.svg
As a library
With CommonJS in JavaScript,
const { makeBadge, ValidationError } = require('badge-maker')
With ESM or TypeScript,
import { makeBadge, ValidationError } from 'badge-maker'
const format = {
label: 'build',
message: 'passed',
color: 'green',
}
const svg = makeBadge(format)
console.log(svg) // <svg...
try {
makeBadge({})
} catch (e) {
console.log(e) // ValidationError: Field `message` is required
}
Node version support
The latest version of badge-maker supports all currently maintained Node versions. See the Node Release Schedule.
Format
The format is the following:
{
label: 'build', // (Optional) Badge label
message: 'passed', // (Required) Badge message
labelColor: '#555', // (Optional) Label color
color: '#4c1', // (Optional) Message color
// (Optional) One of: 'plastic', 'flat', 'flat-square', 'for-the-badge' or 'social'
// Each offers a different visual design.
style: 'flat',
}
Colors
There are three ways to specify color and labelColor:
- One of the Shields named colors:
- A three- or six-character hex color, optionally prefixed with
#:
- Any valid CSS color, e.g.
Raster Formats
Conversion to raster formats is no longer directly supported. In javascript
code, SVG badges can be converted to raster formats using a library like
gm. On the console, the output of badge
can be piped to a utility like
imagemagick
e.g: badge build passed :green | magick svg:- gif:-.