# premultiplied-rgba

> standalone function to premultiply RGB by alpha channel

Latest version **1.0.1** (published 2014-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install premultiplied-rgba
pnpm add premultiplied-rgba
yarn add premultiplied-rgba
bun add premultiplied-rgba
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2014-10-18 |
| First published | 2014-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | premultily, premultiplied, alpha, rgb, rgba, channel, channels |

## Links

- npm: https://www.npmjs.com/package/premultiplied-rgba
- Repository: https://github.com/mattdesl/premultiplied-rgba
- Issues: https://github.com/mattdesl/premultiplied-rgba/issues
- npm.io page: https://npm.io/package/premultiplied-rgba

## 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

- 1.0.1 (latest) — 2014-10-18
- 1.0.0 — 2014-10-01

## README

# premultiplied-rgba

[![frozen](http://badges.github.io/stability-badges/dist/frozen.svg)](http://github.com/badges/stability-badges)

Standalone function to premultiply RGB by alpha channel.

```js
var premult = require('premultiplied-rgba')

premult([1, 1, 1, 0.5]) 

//=> returns new array [0.5, 0.5, 0.5, 0.5]
```

## Usage

[![NPM](https://nodei.co/npm/premultiplied-rgba.png)](https://nodei.co/npm/premultiplied-rgba/)

#### `premultiply(rgba[, out])`

Takes a 4-component array assumed to be in the form `[R, G, B, A]` and returns a new array with the RGB channels multiplied by the alpha channel. 

The `out` param allows you to re-use an array rather than creating a new one. So you can premultiply an array in-place like so:

```premultiply(rgba, rgba)```

The `out` param will ignore numbers, so you can do array operations:

```var premultiplied = colors.map(premultiply)```

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/premultiplied-rgba/blob/master/LICENSE.md) for details.

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