Skip to content

ddprrt/sass-hwb

Repository files navigation

sass-hwb

A Sass function for the HWB color model Build Status

Introduction

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.

Installation

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!

Demo

Try it at Codepen

Credits

  • Kudos to @pangratz for introducing unit tests!