# postcss-color-rgba-fallback

> PostCSS plugin to transform rgba() to hexadecimal

Latest version **4.0.0** (published 2020-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-color-rgba-fallback
pnpm add postcss-color-rgba-fallback
yarn add postcss-color-rgba-fallback
bun add postcss-color-rgba-fallback
```

## 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 | 4.0.0 |
| Published | 2020-01-22 |
| First published | 2015-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 50 |
| Author | Guillaume Démésy |
| Maintainers | magsout, moox, trysound |
| Keywords | css, postcss, postcss-plugin, rgba, hexadecimal |

## Links

- npm: https://www.npmjs.com/package/postcss-color-rgba-fallback
- Repository: https://github.com/postcss/postcss-color-rgba-fallback
- Homepage: https://github.com/postcss/postcss-color-rgba-fallback#readme
- Issues: https://github.com/postcss/postcss-color-rgba-fallback/issues
- npm.io page: https://npm.io/package/postcss-color-rgba-fallback

## Dependencies (3)

- [postcss](https://npm.io/package/postcss.md) ^7.0.17
- [rgb-hex](https://npm.io/package/rgb-hex.md) ^3.0.0
- [postcss-value-parser](https://npm.io/package/postcss-value-parser.md) ^4.0.2

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2020-01-22
- 3.0.0 — 2017-07-08
- 2.2.0 — 2015-12-30
- 2.1.0 — 2015-12-29
- 2.0.0 — 2015-09-06
- 1.3.1 — 2015-07-21
- 1.3.0 — 2015-06-25
- 1.2.0 — 2015-05-23
- 1.1.1 — 2015-04-24
- 1.1.0 — 2015-04-20
- 1.0.0 — 2015-04-16
- 0.1.0 — 2015-04-15

## README

# postcss-color-rgba-fallback [![Travis Build Status](https://travis-ci.org/postcss/postcss-color-rgba-fallback.svg)](https://travis-ci.org/postcss/postcss-color-rgba-fallback)

> [PostCSS](https://github.com/postcss/postcss) plugin to transform rgba() to hexadecimal.

## Installation

```bash
$ npm install postcss-color-rgba-fallback
```

## Usage

```js
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var colorRgbaFallback = require("postcss-color-rgba-fallback")

// css to be processed
var css = fs.readFileSync("input.css", "utf8")

// process css
var output = postcss()
  .use(colorRgbaFallback())
  .process(css)
  .css
```

Using this `input.css`:

```css
body {
  background: rgba(153, 221, 153, 0.8);
  border: solid 1px rgba(100,102,103,.3);
}

```

you will get:

```css
body {
  background: #99DD99;
  background: rgba(153, 221, 153, 0.8);
  border: solid 1px #646667;
  border: solid 1px rgba(100,102,103,.3);
}
```

## Node.js options

postcss-color-rgba-fallback accepts options

### `properties`

default: `
[ "background-color",
  "background",
  "color",
  "border",
  "border-color",
  "outline",
  "outline-color ]
`

Allows you to specify your whitelist of properties.
**This option enables adding a fallback for one or a properties list**

### `oldie`

default: `false`

Set to true to enable the option and to get fallback for ie8

### `backgroundColor`

default: `null`

Allows you to specify a background color to use as a base alpha matte.

Instead of cutting off the alpha channel it will blend the foreground and background.

Expects an array of rgb values:

```js
  "backgroundColor": [255, 1, 1]
```

Checkout [tests](test) for more examples.

---

## Contributing

Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.

    $ git clone https://github.com/postcss/postcss-color-rgba-fallback.git
    $ git checkout -b patch-1
    $ npm install
    $ npm test

## [Changelog](CHANGELOG.md)

## [License](LICENSE)

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