HWB color model
# HWB color model

HWB (Hue, Whiteness, Blackness) is a cylindrical-coordinate representation of points in an RGB color model, similar to HSL and HSV. It was developed by HSV’s creator Alvy Ray Smith in 1996 to address some of the issues with HSV. HWB was designed to be more intuitive for humans to use and slightly faster to compute. The first coordinate, H (Hue), is the same as the Hue coordinate in HSL and HSV. W and B stand for Whiteness and Blackness respectively and range from 0–100% (or 0–1). The mental model is that the user can pick a main hue and then “mix” it with white and/or black to produce the desired color.

HWB was included in the CSS Level 4 Color Module in 2014.

## Conversion

HWB is very closely related to HSV, and therefore the conversion formulas are fairly simple. Before conversion from HWB, if the sum of whiteness and blackness exceeds 100%, both components must be scaled back proportionally to make the sum 100%.

| HSV to HWB | HWB to HSV | RGB to HWB |
| - | - | - |
| ${\begin{aligned}H&=H\\W&=(1-S)V\\B&=1-V\end{aligned}}$ | ${\begin{aligned}H&=H\\S&=1-{\frac {W}{1-B}}\\V&=1-B\end{aligned}}$ | ${\begin{aligned}H&=\ldots \\W&=\min(R,G,B)\\B&=1-\max(R,G,B)\end{aligned}}$ |

## Swatches

The CSS Color Level 4 draft specification includes a number of HWB example color swatches.

0° Reds :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

30° Red-Yellows (Oranges) :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

60° Yellows :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

90° Yellow-Greens (Chartreuse Greens) :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

120° Greens :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

150° Green-Cyans (Spring Greens) :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

180° Cyans :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

210° Cyan-Blues (Azures) :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

240° Blues :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

270° Blue-Magentas (Violets) :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

300° Magentas :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%

330° Magenta-Reds (Roses) :

* BW
* 000%
* 020%
* 040%
* 060%
* 080%
* 100%
