The hwb()
functional notation expresses an sRGB color according to its hue, whiteness, and blackness. An optional alpha component represents the color's transparency.
On this page
hwb()
Try it
Syntax
css
hwb(194 0% 0%) /* #00c3ff */
hwb(194 0% 0% / .5) /* #00c3ff with 50% opacity */
Values
Functional notation: hwb(H W B[ / A])
-
H
-
A
<number>
, an<angle>
, or the keywordnone
, which represents the hue angle. More details on this type can be found on the<hue>
reference. W
,B
-
Each as a
<percentage>
or the keywordnone
, which represent whiteness and blackness, respectively. They specify the amount of white and black to mix in, from0%
(no whiteness or blackness) to100%
(full whiteness or blackness).If
W + B = 100%
, it defines some shade of gray. IfW + B > 100%
,W
andB
are effectively normalized asW / (W + B)
andB / (W + B)
, respectively. A
Optional-
An
<alpha-value>
or the keywordnone
, where the number1
corresponds to100%
(full opacity).
Note: This functional notation serializes to sRGB values, and the values of the red, green, blue components may be rounded in serialization.
Note: See Missing color components for the effect of none
.
Formal syntax
Specifications
Specification |
---|
CSS Color Module Level 4 # the-hwb-notation |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
hwb |
101 | 101 | 96 | No | 87 | 15 | 101 | 101 | 96 | 70 | 15 | 19.0 |
See also
<color>
: For a list of all color notations
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb