# colormap

> Great looking color maps

Latest version **2.3.2** (published 2021-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install colormap
pnpm add colormap
yarn add colormap
bun add colormap
```

## Health

**Score 23/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.2 |
| Published | 2021-02-02 |
| First published | 2013-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/colormap) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 620.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 238 |
| Author | bpostlethwaite |
| Maintainers | jmmease, chriddyp, verazabeida, bpostlethwaite, alexcjohnson, nicolaskruchten, antrg, archmoj, xhlu, jody_plotly, dmt0, emmanuelle, rpkyle, andrefarzat, harryturr, hammadtheone |
| Keywords | colormap, color map, color, hex, rgb, color-space, cubehelix, inferno, magma, plasma, viridis, matplotlib, oceanography, seismic, color gradient, color range, colorscale, color scale, plot, graph |

## Links

- npm: https://www.npmjs.com/package/colormap
- Repository: https://github.com/bpostlethwaite/colormap
- Homepage: https://github.com/bpostlethwaite/colormap#readme
- Issues: https://github.com/bpostlethwaite/colormap/issues
- npm.io page: https://npm.io/package/colormap

## Dependencies (1)

- [lerp](https://npm.io/package/lerp.md) ^1.0.3

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 2.3.2 (latest) — 2021-02-02
- 2.3.1 — 2019-04-02
- 2.3.0 — 2017-09-28
- 2.2.0 — 2016-06-07
- 2.1.2 — 2016-01-21
- 2.1.0 — 2016-01-20
- 2.0.1 — 2014-11-10
- 2.0.0 — 2014-10-25
- 1.3.1 — 2014-10-19
- 1.3.0 — 2014-10-19
- 1.2.2 — 2014-08-25
- 1.1.1 — 2014-08-11
- 1.0.0 — 2014-08-11
- 0.3.7 — 2013-03-07
- 0.3.6 — 2013-03-07
- … 10 more at https://npm.io/package/colormap/versions

## README

# colormap [![Build Status](https://travis-ci.org/bpostlethwaite/colormap.png)](https://travis-ci.org/bpostlethwaite/colormap)

![all colormap output](./colormaps.png)

## Usage

[![npm install colormap](https://nodei.co/npm/colormap.png?mini=true)](https://npmjs.org/package/colormap/)

```js
let colormap = require('colormap')

let colors = colormap({
    colormap: 'jet',
    nshades: 10,
    format: 'hex',
    alpha: 1
})
```

## API

### list = colormap(options?)

Property | Default | Meaning
---|---|---
`colormap` | `'jet'` | Color map name from the image above or a custom color scale — a sequence of `{index, rgb}` objects, where index is `0..1` number and `rgb` is a length 3/4 array with values for the color stop.
`nshades` | `72` | Number of colors in returned array, the minimum number depends on `colormap`.
`format` | `'hex'` | `'hex'` for `#aabbcc`, `'rgbaString'` for `rgba(255, 255, 255, 1)`, `'rba'` for `[255, 255, 255, 1]`, `'float'` for `[1, 1, 1, 1]`.
`alpha` | `1` | Alpha range, can be an array with alpha values or just 2 values for start/end colors. |


## Credits

Color maps are inspired by [matplotlib](https://github.com/d3/d3-scale#sequential-color-scales) color scales, [cmocean](https://github.com/matplotlib/cmocean) oceanographic colormaps, [cosine gradients](https://github.com/thi-ng/color/blob/master/src/gradients.org) and others. Thanks to authors of these libs for their invaluable work.

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