https://github.com/postcss/postcss-color-hwb
PostCSS plugin to transform W3C CSS hwb() function to more compatible CSS (rgb() or rgba()).
https://github.com/postcss/postcss-color-hwb
Last synced: 4 months ago
JSON representation
PostCSS plugin to transform W3C CSS hwb() function to more compatible CSS (rgb() or rgba()).
- Host: GitHub
- URL: https://github.com/postcss/postcss-color-hwb
- Owner: postcss
- License: mit
- Created: 2014-09-28T06:44:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-05-11T18:14:23.000Z (almost 5 years ago)
- Last Synced: 2024-04-14T03:01:02.377Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 21
- Watchers: 7
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# postcss-color-hwb [](https://jonathantneal.github.io/css-db/#css-color-the-hwb-notation) [](https://travis-ci.org/postcss/postcss-color-hwb)
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS hwb() color](http://dev.w3.org/csswg/css-color/#the-hwb-notation) to more compatible CSS (rgb() (or rgba())).
## Installation
```bash
$ npm install postcss-color-hwb
```
## Usage
```js
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var colorHwb = require("postcss-color-hwb")
// css to be processed
var css = fs.readFileSync("input.css", "utf8")
// process css
var output = postcss()
.use(colorHwb())
.process(css)
.css
```
Using this `input.css`:
```css
body {
color: hwb(90, 0%, 0%, 0.5);
}
```
you will get:
```css
body {
color: rgba(128, 255, 0, 0.5);
}
```
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-hwb.git
$ git checkout -b patch-1
$ npm install
$ npm test
## [Changelog](CHANGELOG.md)
## [License](LICENSE)