# postcss-rgb-mapping

> Remaps rgb(a) values to an rgb postfixed variable

Latest version **2.0.0** (published 2024-05-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install postcss-rgb-mapping
pnpm add postcss-rgb-mapping
yarn add postcss-rgb-mapping
bun add postcss-rgb-mapping
```

## 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 | 2.0.0 |
| Published | 2024-05-20 |
| First published | 2023-03-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adobe |
| Maintainers | patrickfulton, castastrophe |
| Keywords | css, rgb, plugin, postcss |

## Links

- npm: https://www.npmjs.com/package/postcss-rgb-mapping
- npm.io page: https://npm.io/package/postcss-rgb-mapping

## Dependencies (1)

- [postcss-value-parser](https://npm.io/package/postcss-value-parser.md) ^4.2.0

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

- 2.0.0 (latest) — 2024-05-20
- 1.1.0 — 2023-05-02
- 1.0.1 — 2023-03-25
- 1.0.0 — 2023-03-25

## README

# postcss-rgb-mapping

> Remaps rgb(a) values to an `rgb` postfixed variable. If an opacity is found, creates a separate `opacity` postfixed variable.

## Installation

```sh
yarn add -D postcss-rgb-mapping
postcss -u postcss-rgb-mapping -o dist/index.css src/index.css
```

## Usage

This plugin turns this:

```css
.spectrum--lightest {
  --spectrum-seafoam-100: rgba(206, 247, 243);
  --spectrum-seafoam-200: rgba(170, 241, 234, 0.5);
}
```

Into this:

```css
.spectrum--lightest {
  --spectrum-seafoam-100-rgb: 206, 247, 243;
  --spectrum-seafoam-100: rgba(var(--spectrum-seafoam-100-rgb));
  --spectrum-seafoam-200-rgb: 170, 241, 234;
  --spectrum-seafoam-200-opacity: 0.5;
  --spectrum-seafoam-200: rgba(
    var(--spectrum-seafoam-200-rgb),
    var(--spectrum-seafoam-200-opacity)
  );
}
```

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