# postcss-color-gray

> Use the gray() color function in CSS

Latest version **5.0.0** (published 2018-10-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install postcss-color-gray
pnpm add postcss-color-gray
yarn add postcss-color-gray
bun add postcss-color-gray
```

## Health

**Score 38/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2018-10-10 |
| First published | 2014-10-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/postcss-color-gray) |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 3 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Shinnosuke Watanabe |
| Maintainers | jonathantneal, moox, semigradsky, shinnn |
| Keywords | postcss, css, postcss-plugin, gray, color, lab, transform, function, csswg, w3c, specification |

## Links

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

## Dependencies (3)

- [postcss](https://npm.io/package/postcss.md) ^7.0.5
- [postcss-values-parser](https://npm.io/package/postcss-values-parser.md) ^2.0.0
- [@csstools/convert-colors](https://npm.io/package/@csstools/convert-colors.md) ^1.4.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

- 5.0.0 (latest) — 2018-10-10
- 4.1.0 — 2017-12-19
- 4.0.0 — 2017-05-15
- 3.0.1 — 2016-11-28
- 3.0.0 — 2015-09-08
- 2.0.0 — 2015-01-27
- 1.1.0 — 2014-11-25
- 1.0.0 — 2014-11-01
- 0.1.0 — 2014-10-29
- 0.0.0 — 2014-10-29

## README

# PostCSS Gray [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]

[![NPM Version][npm-img]][npm-url]
[![CSS Standard Status][css-img]][css-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]

[PostCSS Gray] lets you use the `gray()` color function in CSS, following the
[CSSWG Specification].

```pcss
body {
  background-color: gray(100);
  color: gray(0 / 90%);
}

/* becomes */

body {
  background-color: rgb(255,255,255);
  color: rgba(0,0,0,.9);
}
```

## Usage

Add [PostCSS Gray] to your project:

```bash
npm install postcss-color-gray --save-dev
```

Use [PostCSS Gray] to process your CSS:

```js
import postcssGray from 'postcss-color-gray';

postcssGray.process(YOUR_CSS /*, processOptions, pluginOptions */);
```

Or use it as a [PostCSS] plugin:

```js
import postcss from 'postcss';
import postcssGray from 'postcss-color-gray';

postcss([
  postcssGray(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

[PostCSS Gray] runs in all Node environments, with special instructions for:

| [Node](INSTALL.md#node) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- |

## Options

### preserve

The `preserve` option determines whether the original `gray()` function should
be preserved or replaced. By default, the `gray()` function is replaced.

By setting `preserve` to `true`, the original `gray()` function is preserved.

```js
postcssGray({ preserve: true });
```

```pcss
body {
  background-color: gray(100);
  color: gray(0 / 90%);
}

/* becomes */

body {
  background-color: gray(100);
  background-color: rgb(255,255,255);
  color: gray(0 / 90%);
  color: rgba(0,0,0,.9);
}
```

[cli-img]: https://img.shields.io/travis/postcss/postcss-color-gray.svg
[cli-url]: https://travis-ci.org/postcss/postcss-color-gray
[css-img]: https://cssdb.org/badge/gray-function.svg
[css-url]: https://cssdb.org/#gray-function
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/postcss-color-gray.svg
[npm-url]: https://www.npmjs.com/package/postcss-color-gray

[PostCSS]: https://github.com/postcss/postcss
[PostCSS Gray]: https://github.com/postcss/postcss-color-gray
[CSSWG Specification]: https://drafts.csswg.org/css-color/#grays

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