A Sass function for the HWB color model
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.
Install it with bower or download the _hwb.scss
file from this repository.
bower install --save sass-hwb
Include the _hwb.scss
file in your main Sass file:
@import "/bower_components/sass-hwb/src/hwb";
And start using it:
body {
// results in rgba(128, 255, 0, 0.5)
background-color: hwb(90deg, 0, 0, 0.5);
// results in #80e9ff
color: hwb(190deg, 0.5, 0);
}
Enjoy!
Try it at Codepen
- Kudos to @pangratz for introducing unit tests!