# @sourcetoad/add-badge

> Node commands to add an overlay badge, inset to the non-transparent area.

Latest version **1.0.1** (published 2025-05-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sourcetoad/add-badge
pnpm add @sourcetoad/add-badge
yarn add @sourcetoad/add-badge
bun add @sourcetoad/add-badge
```

Provides the commands `add-badge`, `add-badges`.

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2025-05-15 |
| First published | 2023-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.0.0 |
| Dependencies | 3 |
| Unpacked size | 218.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Maintainers | sourcetoads, jweberst |

## Links

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

## Dependencies (3)

- [yargs](https://npm.io/package/yargs.md) ^17.7.2
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.3.3
- [@imagemagick/magick-wasm](https://npm.io/package/@imagemagick/magick-wasm.md) ^0.0.34

## Recent versions

- 1.0.1 (latest) — 2025-05-15
- 1.0.0 — 2025-04-09
- 0.9.6 — 2024-05-08
- 0.9.5 — 2024-01-24
- 0.9.4 — 2023-04-13
- 0.9.3 — 2023-03-07
- 0.9.2 — 2023-02-10
- 0.9.1 — 2023-01-23
- 0.9.0 — 2023-01-17

## README

# Add Badge

Node commands to add an overlay badge, inset to the non-transparent area.

| ![](https://github.com/sourcetoad/add-badge/raw/master/samples/output/ic_launcher-xxxhdpi.png) | ![](https://github.com/sourcetoad/add-badge/raw/master/samples/output/ic_launcher_round-xxxhdpi.png) |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |

## Installation

Using npm:

```shell
npm install --save-dev @sourcetoad/add-badge
```

Using yarn:

```shell
yarn add --dev @sourcetoad/add-badge
```

## Usage

Add a badge to a single image:

```shell
npx add-badge <input-image> <output-image> <badge-text> [options]
```

Add a badge to multiple images, modifying them in-place:

```shell
npx add-badges <input-glob> <badge-text> [options]
```

See [fast-glob](https://github.com/mrmlnc/fast-glob) for glob details.

## Options

See [samples](https://github.com/sourcetoad/add-badge/blob/master/SAMPLES.md) for previews.

### Font File `--font-file`

The font file path to use for the badge text.

Type: `file`  
Default: `Roboto Black (Bundled)`

### Font Size `--font-size`

The font size to use for the badge text. The size will be scaled up or down if the image is not 192px.

Type: `point`  
Default: `28`

### Text Color `--text-color`

The color to use for the badge text. Use `transparent` for transparent text.

Type: `color`  
Default: `#666666`

### Background Color `--background-color`

The color to use for the badge background.

Type: `color`  
Default: `#ffffff`

### Shadow Color `--shadow-color`

The color to use for the badge shadow.

Type: `color`  
Default: `rgba(0,0,0,0.6)`

### Gravity `--gravity`

The gravity to use for the badge. The badge will be placed in the corner specified by the gravity.

Type: `northwest | north | northeast | southwest | south | southeast`  
Default: `southeast`

### Position `--position`

If set, the badge will be placed manually instead of automatically. If only one number is provided, the badge will be placed on the gravity axis at the position. If two are provided, the first will be the `x` position and the second will be the `y` position.

Numbers are in percent of the image's dimensions (integer).

Type: `number | number,number`  
Default: `undefined`

### Dry Run `--dry-run`/`-d`

If set, the command will only preview the files that would be changed.

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