A Rework plugin for hwb color functions, as proposed in CSS Color Module Level 4 Working Draft.
The HWB color model is coming to CSS, and you can use it right now with Sass. Read more about the HWB model here and at the W3C working draft for the CSS color module, level 4.
$ npm install rework-color-hwb
Example Rework code:
'use strict';
var fs = require('fs'),
rework = require('rework'),
hwb = require('rework-hwb');
var css = fs.readFileSync('css/main.css', 'utf8').toString();
var output = rework(css)
.use(hwb)
.toString();
fs.writeFileSync('dist/main.output.css', output);
And start using it:
body {
background-color: hwb(90deg, 0, 0, 0.5); /* results in rgba(127, 255, 0, 0.5) */
color: hwb(190deg, 0.5, 0); /* results in rgb(127,233,255) */
}
- @pangratz for unit tests
- @ianstormtaylor, who made the
rework-color-function
, and whose code structure inspired this plugin