# svg-heatmap

> Generate GitHub-like heatmap graphs with SVG

Latest version **5.0.1** (published 2026-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install svg-heatmap
pnpm add svg-heatmap
yarn add svg-heatmap
bun add svg-heatmap
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.1 |
| Published | 2026-10-06 |
| First published | 2020-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jayden Chan |
| Maintainers | jayden-chan |

## Links

- npm: https://www.npmjs.com/package/svg-heatmap
- Repository: https://git.sr.ht/~jayden-chan/svg-heatmap
- npm.io page: https://npm.io/package/svg-heatmap

## Dependencies (1)

- [date-fns](https://npm.io/package/date-fns.md) ^4.4.0

## Recent versions

- 5.0.1 (latest) — 2026-10-06
- 5.0.0 — 2026-06-04
- 4.0.2 — 2026-06-02
- 4.0.1 — 2026-06-02
- 4.0.0 — 2026-06-01
- 3.2.0 — 2025-11-12
- 3.1.0 — 2025-09-16
- 3.0.0 — 2024-11-27
- 2.1.0 — 2021-08-19
- 2.0.0 — 2021-07-13
- 1.0.3 — 2020-11-12
- 1.0.2 — 2020-11-02
- 1.0.1 — 2020-11-02
- 1.0.0 — 2020-11-02

## README

# svg-heatmap

Generate GitHub-style SVG heatmaps

## Install

```
pnpm add svg-heatmap
```

## Usage

```javascript
import { generate, PalettePresets } from "svg-heatmap";

// Push some random data
const data = [];
for (let i = 0; i < 365; i++) {
  // For discrete palettes the range of the data should be [0, palette.length)
  // For the auto generated palette the data can be any non-negative number
  data.push(Math.floor(Math.random() * PalettePresets.gitHub.length));
}

const svg = generate(data, 2019, PalettePresets.gitHub);
```

## Palette Presets

### GitHub (`gitHub`)

![Example](./examples/github.svg)

### GitHub Old (`gitHubOld`)

![Example](./examples/github-old.svg)

### Blue (`blue`)

![Example](./examples/blue.svg)

### Auto Generated Palette

![Example](./examples/auto.svg)

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