# css-color-function

> A parser and converter for Tab Atkins's proposed color function in CSS.

Latest version **1.3.3** (published 2017-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-color-function
pnpm add css-color-function
yarn add css-color-function
bun add css-color-function
```

## 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.3.3 |
| Published | 2017-10-07 |
| First published | 2013-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 90 |
| Maintainers | thegaw, moox, kinday, ianstormtaylor |
| Keywords | color, function, css, parse, convert |

## Links

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

## Dependencies (4)

- [rgb](https://npm.io/package/rgb.md) ~0.1.0
- [color](https://npm.io/package/color.md) ^0.11.0
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [balanced-match](https://npm.io/package/balanced-match.md) 0.1.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.3.3 (latest) — 2017-10-07
- 1.3.2 — 2017-10-05
- 1.3.0 — 2016-01-06
- 1.2.1 — 2015-03-17
- 1.2.0 — 2015-03-06
- 1.1.2 — 2014-11-27
- 1.1.1 — 2014-08-26
- 1.1.0 — 2014-08-13
- 1.0.0 — 2014-08-11
- 0.1.0 — 2013-12-25
- 0.0.2 — 2013-12-17
- 0.0.1 — 2013-12-16

## README

# css-color-function
  
  A parser and converter for [Tab Atkins](https://github.com/tabatkins)'s [proposed color function](http://dev.w3.org/csswg/css-color/#modifying-colors) in CSS.

## Installation

    $ npm install css-color-function

## Example

```js
var color = require('css-color-function');

color.convert('color(red tint(50%))');
// "rgb(255, 128, 128)"

color.parse('color(red blue(+ 30))');
// {
//   type: 'function',
//   name: 'color',
//   arguments: [
//     {
//       type: 'color',
//       value: 'red'
//     },
//     {
//       type: 'function',
//       name: 'blue',
//       arguments: [
//         {
//           type: 'modifier',
//           value: '+'
//         },
//         {
//           type: 'number',
//           value: '30'
//         }
//       ]
//     }
//   ]
// }
```

## API

### color.convert(string)

  Convert a color function CSS `string` into an RGB color string.

### color.parse(string)

  Parse a color function CSS `string` and return an AST.

## License

  The MIT License (MIT)

  Copyright (c) 2013 Ian Storm Taylor &lt;ian@segment.io&gt;

  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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