# badge-up2

> A module that produces SVG badges

Latest version **2.0.6** (published 2026-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install badge-up2
pnpm add badge-up2
yarn add badge-up2
bun add badge-up2
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2026-05-30 |
| First published | 2023-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Hair |
| Maintainers | stevenhair |
| Keywords | badge |

## Links

- npm: https://www.npmjs.com/package/badge-up2
- Repository: https://github.com/stevenhair/badge-up2
- Homepage: https://github.com/stevenhair/badge-up2#readme
- Issues: https://github.com/stevenhair/badge-up2/issues
- npm.io page: https://npm.io/package/badge-up2

## Dependencies (3)

- [dot](https://npm.io/package/dot.md) ^1.1.3
- [svgo](https://npm.io/package/svgo.md) ^4.0.0
- [css-color-names](https://npm.io/package/css-color-names.md) ^1.0.1

## Recent versions

- 2.0.6 (latest) — 2026-05-30
- 2.0.5 — 2026-05-25
- 2.0.4 — 2026-03-04
- 2.0.3 — 2026-01-21
- 2.0.2 — 2026-01-21
- 2.0.1 — 2023-10-15
- 2.0.0 — 2023-10-15
- 1.0.0 — 2023-09-29

## README

# badge-up2


[![Build](https://github.com/stevenhair/badge-up2/actions/workflows/test.yml/badge.svg)](https://github.com/stevenhair/badge-up2/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/stevenhair/badge-up2/graph/badge.svg?token=TJ5H79MK4E)](https://codecov.io/gh/stevenhair/badge-up2)
[![npm](https://img.shields.io/npm/v/badge-up2.svg?maxAge=2592000)](https://www.npmjs.com/package/badge-up2)
[![downloads](https://img.shields.io/npm/dt/badge-up2.svg?maxAge=2592000)](https://www.npmjs.com/package/badge-up2)

This is a simple library that generates SVG badges, based on [badge-up](https://www.npmjs.com/package/badge-up).


## Install

`npm install badge-up2`


## Basic Usage

```js
const { basic, basicColors } = require('badge-up2');
const svg = basic('batman', 'component', basicColors.green);
```

![example](https://raw.githubusercontent.com/stevenhair/badge-up2/master/src/test-data/basic.svg)

The color argument can be a CSS color, or one of the specially named colors
found in `basicColors`.

## Advanced Usage

With this API you can create arbitrary badges with an arbitrary number of sections.

Each section is either a string or a hash.
The hash should have the following properties:
* `text`: The text to display in the section
* `color` (optional): The background color of the section. This can be either a six-character hex code or a css color name.
* `strokeColor` (optional): The color of the section border

If `color` is not provided, then a default is used.
The default color for the first section is `#696969` and `#d3d3d3` for subsequent sections.
Passing a string rather than a hash is equivalent to passing a hash with only the `text` property.

```js
const { badge } = require('badge-up2');
const sections = [
    'foo/far;fun',
    { text: 'bar\nbaz', color: 'orange'},
    { text: 'mork "mindy"', color: 'olive', strokeColor: 'white'},
    { text: '<∀>', color: 'moccasin'},
];
const svg = badge(sections);
```

![example](https://raw.githubusercontent.com/stevenhair/badge-up2/master/src/test-data/example.svg)

---
_Source: https://npm.io/package/badge-up2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
