CSS: HWB color (hue whiteness blackness)

By Xah Lee. Date: . Last updated: .

What is HWB color

HWB stand for Hue Whiteness Blackness. It is a color model similar to HSL Color and is supposed to be intuitive for humans.

think of it as starting with a color and mix it with amounts of white and black.

Syntax

hwb(hue whiteness blackness)

opacity

hwb(hue whiteness blackness / opacity)

example

.x {

 color: hwb(180 12 8);

/* dropping the percentage % sign */
 color: hwb(180 12% 8%);

 /* first arg can be any angle unit */
 color: hwb(180deg 12 8);
 color: hwb(0.5turn 12 8);
}
.x {
 /* with opacity  */
 color: hwb(120 30 10 / 0.5);
 /* or */
 color: hwb(120 30% 10% / 0.5);
}

HWB color samples

when both whiteness and blackness is above 50%, or if they add up to 100, the color becomes gray.

CSS Color