### oklab() example color values Source: https://www.w3.org/TR/css-color-4 Example oklab() color values. Lightness values below 0% or above 100% are clamped at parse time; a lightness of 0% or 100% displays as black or white due to gamut mapping. The a and b arguments are signed and may be percentages or numbers. ```css oklab(40.101% 0.1147 0.0453); oklab(59.686% 0.1009 0.1192); oklab(0.65125 -0.0320 0.1274); oklab(66.016% -0.1084 0.1114); oklab(72.322% -0.0465 -0.1150); oklab(42.1% 41% -25%) ``` -------------------------------- ### oklch() example color values Source: https://www.w3.org/TR/css-color-4 Example oklch() color values. If chroma is 0% or 0, the hue component is powerless; a lightness of 0% or 100% displays as black or white due to gamut mapping. Hue angles repeat every 360 degrees. ```css oklch(40.101% 0.12332 21.555); oklch(59.686% 0.15619 49.7694); oklch(0.65125 0.13138 104.097); oklch(0.66016 0.15546 134.231); oklch(72.322% 0.12403 247.996); oklch(42.1% 48.25% 328.4) ``` -------------------------------- ### HTML and CSS: currentcolor resolution example Source: https://www.w3.org/TR/css-color-4 Shows how currentcolor resolves in inherited properties. The used value of text-shadow on the first line fragment is yellowgreen. ```html
Assume this example text is long enough to wrap on multiple lines.
Some really emphasized text.
```
--------------------------------
### hwbToRgb() conversion function
Source: https://www.w3.org/TR/css-color-4
JavaScript implementation of the HWB-to-sRGB conversion algorithm. It normalizes white and black so their sum is no larger than 100%, returns a gray when white+black >= 1, and otherwise converts via hslToRgb and adjusts the RGB components. Expects hue in degrees 0..360 and white/black in the reference range [0,100].
```javascript
/**
* @param {number} hue - Hue as degrees 0..360
* @param {number} white - Whiteness in reference range [0,100]
* @param {number} black - Blackness in reference range [0,100]
* @return {number[]} Array of RGB components 0..1
*/
function hwbToRgb(hue, white, black) {
white /= 100;
black /= 100;
if (white + black >= 1) {
let gray = white / (white + black);
return [gray, gray, gray];
}
let rgb = hslToRgb(hue, 100, 50);
for (let i = 0; i < 3; i++) {
rgb[i] *= (1 - white - black);
rgb[i] += white;
}
return rgb;
}
```
--------------------------------
### Equivalent color notations for white in xyz-d50 and xyz-d65
Source: https://www.w3.org/TR/css-color-4
Shows equivalent color notations for white, including hex and color() with xyz-d50 and xyz-d65 spaces.
```css
#FFFFFF
color(xyz-d50 0.9643 1 0.8251)
color(xyz-d65 0.9505 1 1.089)
```
--------------------------------
### hwb() function syntax
Source: https://www.w3.org/TR/css-color-4
Defines the formal grammar of the hwb() color function. The first argument is the hue (same as hsl()), the second and third are whiteness and blackness percentages, and the optional fourth is an alpha value. Commas are not allowed; using them is an error.
```css
hwb() = hwb(
[