<pre class=metadata>
Title: CSS Color Module Level 4
Status: ED
Prepare for TR: no
Work Status: Testing
ED: https://drafts.csswg.org/css-color-4/
TR: https://www.w3.org/TR/css-color-4/
Shortname: css-color
Group: csswg
Level: 4
Implementation Report: https://wpt.fyi/results/css/css-color
Editor: Tab Atkins Jr., Google, http://xanthir.com/contact, w3cid 42199
Editor: Chris Lilley, W3C, https://svgees.us/, w3cid 1438
Editor: Lea Verou, Invited Expert, http://lea.verou.me/, w3cid 52258
Former Editor: L. David Baron, Google https://www.google.com/, https://dbaron.org/, w3cid 15393
Abstract: This specification describes CSS <<color>> values, and properties for foreground color and group opacity. It also describes how colors are interpolated, and how to gamut map colors.
Repository: w3c/csswg-drafts
Ignored Terms: double, octet
Complain About: missing-example-ids true
Complain About: broken-links false
Complain About: accidental-2119 true
Inline Github Issues: title
Default Highlight: css
WPT Path Prefix: css/css-color/
WPT Display: open
</pre>

<pre class="link-defaults">
spec: css2; type: dfn; text: stacking context
spec: css2; type:property; text:z-index
spec:infra; type:dfn; text:string
spec: css-cascade-5; type:dfn; text:used value
spec: css-cascade-5; type:dfn; text:computed value
spec: css-cascade-5; type:dfn; text:specified value
spec: css-cascade-5; type:dfn; text:initial value
spec: css-backgrounds-3; type: property; text: background
spec: css-backgrounds-3; type: property; text: background-color
spec: css-backgrounds-3; type: property; text: border-color
spec: css-backgrounds-3; type: property; text: border-top-color
spec: css-backgrounds-3; type: property; text: border-left-color
spec: css-backgrounds-3; type: property; text: border-bottom-color
spec: css-backgrounds-3; type: property; text: border-right-color
spec: css-ui-4;	type: dfn; text: accent color
spec: css-ui-4; type: property; text: accent-color
spec:css-color-5; type:value; for:oklab(); 
	text:a
	text:b
	text:l
spec:css-color-5; type:value; for:oklch(); 
	text:c
	text:h
</pre>


<pre class=biblio>
	{
		"Abney": {
			"title": "Abney effect",
			"href": "https://en.wikipedia.org/wiki/Abney_effect"
		},
		"TIFF": {
			"href": "https://www.loc.gov/preservation/digital/formats/fdd/fdd000022.shtml",
			"title": "TIFF Revision 6.0",
			"date": "3 June 1992"
		},
		"Sharma": {
			"href": "https://www.hajim.rochester.edu/ece/sites/gsharma/ciede2000/",
			"title": "The CIEDE2000 Color-Difference Formula: Implementation Notes, Supplementary Test Data, and Mathematical Observations",
			"authors": ["G. Sharma", "W. Wu", "E. N. Dalal"],
			"journal": "Color Research and Application, vol. 30. No. 1, pp. 21-30",
			"date": "February 2005"
		},
		"Oklab": {
			"href": "https://bottosson.github.io/posts/oklab/",
			"title": "A perceptual color space for image processing",
			"authors": ["Björn Ottosson"],
			"date": "December 2020"
		},
		"HSL": {
			"title": "Color spaces for computer graphics",
			"authors": ["George H. Joblove, Donald Greenberg"],
			"journal": "ACM SIGGRAPH Computer Graphics Volume 12 Issue 3 pp 20–25",
			"date": "August 1978",
			"href": "https://doi.org/10.1145/965139.807362"
		},
		"HWB": {
			"title": "HWB — A More Intuitive Hue-Based Color Model",
			"authors": ["Alvy Ray Smith"],
			"journal": "Journal of Graphics, GPU and Game tools. 1 (1): 3–17 ",
			"date": "1996",
			"href": "http://alvyray.com/Papers/CG/HWB_JGTv208.pdf"
		},
		"Display-P3": {
			"title": "Display P3",
			"authors": ["Apple, Inc"],
			"date": "2022-02",
			"publisher": "ICC",
			"href": "https://www.color.org/chardata/rgb/DisplayP3.xalter"
		},
		"Wolfe": {
			"title": "Design and Optimization of the ProPhoto RGB Color Encodings",
			"authors": ["Geoff Wolfe"],
			"date": "2011-12-21",
			"href": "http://www.realtimerendering.com/blog/2011-color-and-imaging-conference-part-vi-special-session/"
		},
		"ROMM": {
			"title": "ISO 22028-2:2013 Photography and graphic technology — Extended colour encodings for digital image storage, manipulation and interchange — Part 2: Reference output medium metric RGB colour image encoding (ROMM RGB)",
			"date": "2013-04",
			"publisher": "ISO",
			"href": "https://www.iso.org/standard/56591.html"
		},
		"ROMM-RGB": {
			"title": "ROMM RGB",
			"publisher": "ICC",
			"href": "https://www.color.org/chardata/rgb/rommrgb.xalter"
		},
		"Understanding_CCT": {
			"title": "What is CCT? A Guide to Choosing Correlated Color Temperature for Your Lighting",
			"date": "2024-08-14",
			"href": "https://litomatic.com/blog/what-is-cct-in-lighting/"
		},
		"Rec_BT.1886": {
			"href": "https://www.itu.int/rec/R-REC-BT.1886/en",
			"title": "ITU-R BT.1886 Reference electro-optical transfer function for flat panel displays used in HDTV studio production",
			"publisher": "ITU",
			"date": "2011-03"
		},
		"Coloraide-Ray-Trace": {
			"title": "Ray Tracing Chroma Reduction",
			"date": "2024",
			"authors": ["Isaac Muse"],
			"href": "https://facelessuser.github.io/coloraide/gamut/#ray-tracing-chroma-reduction"
		},
		"Coloraide-MINDE": {
			"title": "OkLCh Chroma",
			"date": "2024",
			"authors": ["Isaac Muse"],
			"href": "https://facelessuser.github.io/coloraide/gamut/#oklch-chroma"
		},
		"colorjs-EdgeSeeker": {
			"title": "EdgeSeeker Gamut Mapping algorithm",
			"date": "2023",
			"authors": ["Alexey Ardov"],
			"href": "https://github.com/color-js/apps/tree/main/gamut-mapping/edge-seeker"
		},
		"colorjs-RayTrace": {
			"title": "Ray Trace Gamut Mapping",
			"date": "2023",
			"authors": ["Isaac Muse"],
			"href": "https://github.com/color-js/apps/blob/2c7346dd00855f7b82eb4c7527355a09b84beeb3/gamut-mapping/methods.js#L273"
		},
		"colorjs-MINDE": {
			"title": "Gamut mapping",
			"authors": ["Chris Lilley"],
			"date": "2022",
			"href": "https://colorjs.io/docs/gamut-mapping"
		}
	}
</pre>

<link rel="stylesheet" href="style.css" />

<style>
table.named-color-table thead th { text-align:center; background:var(--text); color:var(--bg); }
table.named-color-table th, table.named-color-table td { padding: 0 .25em; }
table.named-color-table td { text-align:center; text-transform:uppercase; }
table.named-color-table td:nth-child(-n+2) { border:1px solid var(--text); }
/* table.named-color-table td:nth-child(n+4) { background: ; } */
.color-table {
	background: rgb(46.63% 46.63% 46.63%);
	color: black;
	display: table;
	display: flex;
	flex-flow: row wrap;
	justify-content: space-around;
	padding: 0.5em;
	gap: 2em;
}
.color-table table { padding:1em; margin:0; table-layout: fixed; }
.color-table td, .color-table th { font-size:smaller; }
.color-table th { white-space: pre-line; }
.color-table td {	padding: .75em; }
.color-table .white { color: white; }
table.deltaE td {border: 4px solid white; padding: 6px; font-size: 1.4em; color: black;}
table.deltaE td.dE0 { background: rgb(68, 243, 91)}
table.deltaE td.dE1 { background: rgb(153, 243, 68)}
table.deltaE td.dE2 { background: rgb(217, 243, 68)}
table.deltaE td.dE3 { background: rgb(243, 240, 68)}
table.deltaE td.dE4 { background: rgb(243, 202, 68)}
table.deltaE td.dE5 { background: rgb(243, 103, 68); color: white}
/* work-around for https://github.com/tabatkins/bikeshed/issues/1799 */
div.example {
	overflow: visible;
}
div.example>a.self-link::before {
	content: "¶";
}
</style>

<script>
document.addEventListener("DOMContentLoaded", ()=>{
	for (let e of document.querySelectorAll(".swatch")) {
		e.tabIndex = "0";
		const swatchColor = getComputedStyle(e).getPropertyValue("--color");

		if (!CSS.supports('color', swatchColor)) {
			e.style.background = "repeating-linear-gradient(135deg, red 0, red 4px, white 4px, white 8px)";
			e.setAttribute("title", "Your browser does not recognize this color value, so we can't preview it.");
		}
	}
});
</script>

<h2 id="introduction">
Introduction</h2>

	<em>This section is not normative.</em>

	<wpt title="This section is not normative, it does not need tests."></wpt>

	This module describes CSS properties which
	allow authors to specify
	the foreground color and opacity of the text content of an element.
	This module also describes in detail the CSS <<color>> value type.


	It not only defines the color-related properties and values that
	already exist in <a href="https://www.w3.org/TR/CSS1">CSS1</a>, <a
	href="https://www.w3.org/TR/CSS2/">CSS2</a>,
	and <a href="https://www.w3.org/TR/css-color-3/">CSS Color 3</a>,
	but also defines new properties and values.

	In particular, it allows specifying colors
	in other [=color spaces=] than sRGB;
	previously, the more saturated colors outside the sRGB gamut
	could not be used in CSS
	even if the display device supported them.


	A <a href="https://drafts.csswg.org/css-color-4/test-coverage">draft implementation report</a> is available.

<h3 id="values">
Value Definitions</h3>

	This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]]
	using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
	Value types not defined in this specification are defined in CSS Values &amp; Units [[!CSS-VALUES-3]].
	Combination with other CSS modules may expand the definitions of these value types.

	In addition to the property-specific values listed in their definitions,
	all properties defined in this specification
	also accept the <a>CSS-wide keywords</a> as their property value.
	For readability they have not been repeated explicitly.

<!--
████████ ████████ ████████  ██     ██  ██████
   ██    ██       ██     ██ ███   ███ ██    ██
   ██    ██       ██     ██ ████ ████ ██
   ██    ██████   ████████  ██ ███ ██  ██████
   ██    ██       ██   ██   ██     ██       ██
   ██    ██       ██    ██  ██     ██ ██    ██
   ██    ████████ ██     ██ ██     ██  ██████
-->

<h2 id="terminology">Color Terminology</h2>

<wpt title="This section provides definitions used later, it does not need tests."></wpt>

	A <dfn export>color</dfn> is a definition (numeric or textual)
	of the human visual perception of a light
	or a physical object illuminated with light.
	The objective study of human color perception is termed
	<abbr title="colorimetry is the measurement of human color perception">colorimetry</abbr>.

	The color of a physical object
	depends on how much light it reflects
	at each visible wavelength,
	plus the actual color of the light illuminating it
	(again, the amount of light at each wavelength).
	It is measured by a <em>spectrophotometer </em>.

	The color of something that emits light
	(including colors on a computer screen)
	depends on how much light it emits
	at each visible wavelength.
	It is measured by a <em>spectroradiometer</em>.

	If two objects have different
	<abbr title="the amount of light at each wavelength">spectra</abbr>,
	but still produce the same physical sensation,
	we say they have the same color.
	We can calculate whether two colors are the same
	by converting the spectra to CIE XYZ
	(three numbers).

	<div class="example" id="ex-cal-leaf">For example a green leaf, a photograph of that leaf
		displayed on a computer screen, and a print of that photograph,
		are all producing a green sensation by different means.
		If the screen and the printer are [=calibrated=],
		the green in the leaf, and the photo, and the print will look the same.
	</div>

	A <dfn export>color space</dfn> is an organization of colors
	with respect to an underlying
	<abbr title="colorimetry is the measurement of human color perception">colorimetric</abbr>
	model,
	such that there is a clear, objectively-measurable meaning
	for any color in that color space.
	This also means that the same color can be expressed in multiple color spaces,
	or transformed from one color space to another,
	while still looking the same.

	<div class="example" id="ex-leaf-spectro"><p>A leaf is measured
		with a spectrophotometer
		and found to have the color
		<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> lch(51.2345% 21.2 130)
		which is
		<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> lab(51.2345% -13.6271 16.2401).</p>

		<p>This same color could be expressed in various color spaces:</p>

		<pre class="lang-css">
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(sRGB 0.41587 0.503670 0.36664);
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(display-p3 0.43313 0.50108 0.37950);
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(a98-rgb 0.44091 0.49971 0.37408);
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(prophoto-rgb 0.36589 0.41717 0.31333);
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(rec2020 0.6295 0.9657 0.3633);
		</pre>

	</div>

	An <dfn export>additive color space</dfn>
	means that the coordinate system is linear in light intensity.
	The <abbr title="International Commission on Illumination, = Commission internationale de l'éclairage (in French)">CIE</abbr>
	XYZ color space is an additive color space.
	The Y component of XYZ is the
	<dfn export>luminance</dfn>, the light intensity per unit area,
	or 'how bright it is'. Luminance is measured in candelas per square meter.
	cd/m², also called <em>nits</em>.

	In an additive color space, calculations can be done
	to <em>accurately predict</em> color mixing. Most RGB spaces
	are not additive, because the components are
	<em>gamma encoded</em>. Undoing this gamma encoding
	produces linear-light values.

	<div class="example" id="ex-additivity">
		For example, if a light fixture contains two identical colored lights,
		and only one is switched on,
		and the color is measured to be
		<span class="swatch" style="--color: rgb(47.74% 35.59% 21.53%)"></span> color(xyz 0.13 0.12 0.04),
		then the color when both are switched on will be exactly twice that,
		<span class="swatch" style="--color: rgb(65.57% 49.35% 30.58%)"></span> color(xyz 0.26 0.24 0.08).

		If we have two differently colored spotlights shining on a stage,
		and one has the measured value
		<span class="swatch" style="--color: rgb(0% 60.02% 47.86%)"></span>
		color(xyz 0.15 0.24 0.17)
		while the other is
		<span class="swatch" style="--color: rgb(50.45% 9.53% 31.04%)"></span>
		color(xyz 0.11 0.06 0.06)
		then we can accurately predict that if the colored beams are made to overlap,
		the color of the mixture will be the sum
		of the XYZ component values, or
		<span class="swatch" style="--color: rgb(75.5% 51.71% 56.61%)"></span>
		color(xyz 0.26 0.30 0.23).
	</div>

	A <dfn export>chromaticity</dfn> is a color measurement
	where the lightness component has been factored out.
	From the identical lights example above,
	the <em>u',v'</em> chromaticity with one light is
	(0.2537, 0.5268)
	and the chromaticity is the same with both lights
	(they are the same color, it is just brighter).

	Chromaticities are additive,
	so they accurately predict
	the chromaticity (but not the resulting lightness)
	of a mixture.
	Being two-dimensional, chromaticity is easily represented
	on a <em>chromaticity diagram</em>
	to predict the chromaticity of a color mixture.
	Any two colors can be mixed, and the resulting colors
	will lie on the line joining them on the diagram.
	Three colors form a plane, and the resulting colors
	will lie in the triangle they form on the diagram.

	<figure id="fig-ucs-display-p3">
		<img src="images/UCS-display-p3.svg"
		width=500 height=464
			alt="uv chromaticity diagram of the display-p3 color space">
		<figcaption>A chromaticity diagram showing
			(in solid colors) the ''display-p3'' color space
			and for comparison
			(faded) the ''sRGB'' color space.
			The white point (D65) is also shown.
		</figcaption>
	</figure>

	Thus, once linearized, RGB color spaces are additive,
	and their gamut is defined
	by the chromaticities of the red, green and blue primaries,
	plus the chromaticity of the <dfn export>white point</dfn>
	(the color formed by all three primaries at full intensity).

	Most color spaces use one of a few
	daylight-simulating [=white points=],
	which are named by the correlated color temperature (CCT)
	[[Understanding_CCT]]
	of the corresponding black-body radiator.
	For example, [=D65=] is a daylight whitepoint
	corresponding to a correlated color temperature
	of 6500 Kelvin
	(actually 6504,
	because the value of Plank's constant has changed
	since the color was originally defined).

	To avoid cumulative round-trip errors,
	it is important that the identical chromaticity values
	are used consistently,
	at all places in a calculation. Thus,
	for maximum compatibility,
	for this specification,
	the following two standard
	daylight-simulating [=white points=] are defined:

	<table class="data">
		<thead>
			<tr>
				<th>Name&nbsp;</th>
				<th>x</th>
				<th>y</th>
				<th>CCT</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td><dfn export>D50</dfn></td>
				<td>0.345700</td>
				<td>0.358500</td>
				<td>5003K</td>
			</tr>
			<tr>
				<td><dfn export>D65</dfn></td>
				<td>0.312700</td>
				<td>0.329000</td>
				<td>6504K</td>
			</tr>
		</tbody>
	</table>


	When the measured physical characteristics
	(such as the <abbr title="measured color, irrespective of lightness">chromaticities</abbr> of the primary colors it uses,
	or the colors produced in response to a given set of inputs)
	of a [=color space=] or a color-producing device are known,
	it is said to be <dfn export>characterized</dfn>.

	If in addition adjustments have been made so that a device meets calibration targets
	such as white point, neutrality of greys, predictability and consistency of tone response,
	then it is said to be <dfn export>calibrated</dfn>.

	Real physical devices cannot yet produce every possible color that the human eye can see.
	The range of colors that a given device can produce is termed the <dfn export>gamut</dfn>
	<em>(not to be confused with gamma)</em>.
	Devices with a limited gamut cannot produce very saturated colors,
	like those found in a rainbow.

	<figure id="fig-three-gamuts">
		<p><img src="images/sRGB-DisplayP3-rec2020-in-Oklab.png" alt="" width="1538"></p>
		<!-- alt text would be identical to figure caption -->
		<figcaption>
			A top-down view of three gamuts, plotted in Oklab with the positive a-axis towards the right and the positive b-axis towards the top; looking down the l-axis so white and neutrals are in the center. The largest of the three gamuts is ITU Rec BT.2020; the medium-sized one is Display P3, and the smallest is sRGB. Rendering by Alexey Ardov.
		</figcaption>
	</figure>

	The gamuts of different [=color space=]s may be compared
	by looking at the volume (in cubic Lab units) of colors that can be expressed.
	The following table examines the <a href="#predefined">predefined</a> color spaces available in CSS.

	<table class=gamuts>
		<tr>
			<th>color space</th>
			<th>Volume (million Lab units)</th>
		</tr>
		<tr>
			<td>sRGB</td>
			<td>0.820</td>
		</tr>
		<tr>
			<td>display-p3</td>
			<td>1.233</td>
		</tr>
		<tr>
			<td>a98-rgb</td>
			<td>1.310</td>
		</tr>
		<tr>
			<td>prophoto-rgb</td>
			<td>2.896</td>
		</tr>
		<tr>
			<td>rec2020</td>
			<td>2.042</td>
		</tr>
	</table>


	A color in CSS is either an <dfn export>invalid color</dfn>,
	as described below for each syntactic form,
	or a [=valid color=].

	Any color which is not an [=invalid color=] is a <dfn export>valid color</dfn>.

	A color may be a [=valid color=]
	but still be outside the range of colors
	that can be produced by an output device
	(a screen, projector, or printer)

	<!-- unbounded hsl
	or the range of colors that may be represented by a given color model
	(for example HSL or HWB). -->

	It is said to be <dfn export>out of gamut</dfn>.


	Each [=valid color=] is either <dfn export>in-gamut</dfn>
	for a particular output device (screen, or printer)
	<!-- unbounded hsl or color space, -->
	or it is [=out of gamut=].

	<div class="example" id="ex-oog">
		For example, given a screen which covers 100% of the display-p3 color space,
		but no more, the following color is out of gamut:
		<pre>
			<span class="swatch oog" style="--color: rgb(100% 49.562% 17.429%)"></span> color(prophoto-rgb 0.88 0.45 0.10)
		</pre>
		because, expressed in display-p3,
		one or more coordinates are either greater that 1.0 or less than 0.0:
		<pre>
			<span class="swatch oog" style="--color: rgb(100% 49.562% 17.429%)"></span> color(display-p3 1.0844 0.43 0.1)
		</pre>
		This color is valid,
		and could, for example, be used as a gradient stop,
		but would need to be <a>CSS gamut mapped</a> for display,
		producing a similar-looking but lower chroma (less saturated) color.
	</div>

<!--
   ███    ████████  ████████  ██       ██    ██ ████ ██    ██  ██████
  ██ ██   ██     ██ ██     ██ ██        ██  ██   ██  ███   ██ ██    ██
 ██   ██  ██     ██ ██     ██ ██         ████    ██  ████  ██ ██
██     ██ ████████  ████████  ██          ██     ██  ██ ██ ██ ██   ████
█████████ ██        ██        ██          ██     ██  ██  ████ ██    ██
██     ██ ██        ██        ██          ██     ██  ██   ███ ██    ██
██     ██ ██        ██        ████████    ██    ████ ██    ██  ██████
-->

<h2 id="applying-color">Applying Color in CSS</h2>

<!--
   ███       ██      ██   ██    ██
  ██ ██    ████    ████    ██  ██
 ██   ██     ██      ██     ████
██     ██    ██      ██      ██
█████████    ██      ██      ██
██     ██    ██      ██      ██
██     ██  ██████  ██████    ██
-->
<h3 id="accessibility">
Accessibility and Conveying Information By Color</h3>

<wpt title="This section provides authoring guidance, it does not need tests."></wpt>

	Although colors can add significant information to documents
	and make them more readable,
	color by itself should not be the sole means to convey important information.
	Authors should consider the W3C Web Content Accessibility Guidelines [[WCAG21]]
	when using color in their documents.

	> <a href="https://www.w3.org/TR/WCAG21/#use-of-color"><em>1.4.1 Use of Color:</em>
	> Color is not used as the only visual means of conveying information,
	> indicating an action, prompting a response, or distinguishing a visual element</a>


<!--
 ██████   ███████  ██        ███████  ████████        ████████  ████████   ███████  ████████
██    ██ ██     ██ ██       ██     ██ ██     ██       ██     ██ ██     ██ ██     ██ ██     ██
██       ██     ██ ██       ██     ██ ██     ██       ██     ██ ██     ██ ██     ██ ██     ██
██       ██     ██ ██       ██     ██ ████████        ████████  ████████  ██     ██ ████████
██       ██     ██ ██       ██     ██ ██   ██         ██        ██   ██   ██     ██ ██
██    ██ ██     ██ ██       ██     ██ ██    ██        ██        ██    ██  ██     ██ ██
 ██████   ███████  ████████  ███████  ██     ██       ██        ██     ██  ███████  ██
-->

<h3 id="the-color-property">
Foreground Color: the 'color' property</h3>

	<pre class=propdef>
	Name: color
	Value: <<color>>
	Initial: CanvasText
	Applies to: all elements and text
	Inherited: yes
	Percentages: N/A
	Computed value: computed color, see <a href="#resolving-color-values">resolving color values</a>
	Animation type: by computed value type
	</pre>

	<wpt>
	color-001.html
	color-002.html
	color-003.html
	inheritance.html
	animation/color-interpolation.html
	color-initial-canvastext.html
	parsing/color-valid.html
	parsing/color-invalid.html
	</wpt>

	This property specifies the primary foreground color of the element.
	This is used as the fill color of its text content,
	and in addition specifies the [=used value=]
	that ''color/currentcolor'' resolves to,
	which allows indirect references to this foreground color
	and affects the initial values of various other color properties
	such as  'border-color' and 'text-emphasis-color'.

	<dl>
		<dt><<color>>
		<dd>Sets the primary foreground color to the specified <<color>>.
	</dl>

	<div class="example" id="ex-lime">
		The <<color>> type provides multiple ways to syntactically specify a given color.
		For example, the following declarations all specify the sRGB color “lime”:
		<pre class="lang-css">
		em { color: <span class="swatch" style="--color: lime"></span>&nbsp;lime; }   /* color keyword  */
		em { color: <span class="swatch" style="--color: lime"></span>&nbsp;rgb(0 255 0); } /* RGB range 0-255   */
		em { color: <span class="swatch" style="--color: lime"></span>&nbsp;rgb(0% 100% 0%); } /* RGB range 0%-100% */
		em { color: <span class="swatch" style="--color: lime"></span>&nbsp;color(sRGB 0 1 0); } /* sRGB range 0.0-1.0 */
		</pre>
	</div>

	When applied to text, this property, including its alpha component,
	has no effect on “color glyphs” (such as the emoji in some fonts),
	which are colored by a built-in palette.
	However, some colored fonts are able to refer to a contextual “foreground color”,
	such as by palette entry ''0xFFFF'' in the <code>COLR</code> table of OpenType,
	or by the ''context-fill'' value in SVG-in-OpenType.
	In such cases, the foreground color is set by this property,
	identical to how it sets the ''<color>/currentcolor'' value.


<!--
 ███████  ████████     ███     ██████  ████ ████████ ██    ██
██     ██ ██     ██   ██ ██   ██    ██  ██     ██     ██  ██
██     ██ ██     ██  ██   ██  ██        ██     ██      ████
██     ██ ████████  ██     ██ ██        ██     ██       ██
██     ██ ██        █████████ ██        ██     ██       ██
██     ██ ██        ██     ██ ██    ██  ██     ██       ██
 ███████  ██        ██     ██  ██████  ████    ██       ██
-->

<h3 id="transparency">
Transparency: the 'opacity' property</h3>

	Opacity can be thought of as a postprocessing operation.
	Conceptually, after the element (including its descendants) is rendered into an RGBA offscreen image,
	the opacity setting specifies how to blend the offscreen rendering into
	the current composite rendering.
	See <a href="#alpha">simple alpha compositing</a> for details.

	<pre class=propdef>
	Name: opacity
	Value: <<opacity-value>>
	Initial: 1
	Applies to: all elements
	Inherited: no
	Percentages: map to the range [0,1]
	Computed value: specified number, clamped to the range [0,1]
	Animation type: by computed value type
	</pre>

	<wpt>
		clip-opacity-out-of-flow.html
		t32-opacity-basic-0.0-a.xht
		t32-opacity-basic-0.6-a.xht
		t32-opacity-basic-1.0-a.xht
		t32-opacity-clamping-0.0-b.xht
		t32-opacity-clamping-1.0-b.xht
		t32-opacity-offscreen-b.xht
		t32-opacity-offscreen-multiple-boxes-1-c.xht
		t32-opacity-offscreen-multiple-boxes-2-c.xht
		t32-opacity-offscreen-with-alpha-c.xht
		t32-opacity-zorder-c.xht
		parsing/opacity-computed.html
		parsing/opacity-valid.html
		parsing/opacity-invalid.html
		composited-filters-under-opacity.html
		filters-under-will-change-opacity.html
		animation/color-composition.html
		animation/opacity-interpolation.html
		canvas-change-opacity.html
		animation/opacity-animation-ending-correctly-001.html
		animation/opacity-animation-ending-correctly-002.html
	</wpt>

	<dl>
		<dt><dfn dfn-for="opacity"><<opacity-value>></dfn>
		<dd>
			The opacity to be applied to the element.
			The resulting opacity is applied to the entire element,
			rather than a particular color.

			Opacity values outside the range [0,1] are not invalid,
			and are preserved in specified values,
			but are clamped to the range [0, 1]
			in computed values.
	</dl>

	<wpt>
		inline-opacity-float-child.html
	</wpt>

	Opacity in CSS is represented using the <<opacity-value>> syntax,
	for example in the 'opacity' property.

	<pre class='prod'>
		<<opacity-value>> = <<number>> | <<percentage>>
	</pre>

	Represented as a <<number>>, the useful range of the value is ''0''
	(representing full transparency)
	to ''1''
	(representing full opacity).
	It can also be written as a <<percentage>>,
	which [=computed value|computes to=]
	the equivalent <<number>>
	(''0%'' to ''0'', ''100%'' to ''1'').

	The 'opacity' property applies the specified opacity to the element <em>as a whole</em>,
	including its contents,
	rather than applying it to each descendant individually.
	This means that, for example,
	an opaque child occluding part of the element's background will continue to do so even when 'opacity' is less than 1,
	but the element and child as a whole will show the underlying page through themselves.

	<!-- needs a code example and rendered result for those two cases -->

	It also means that the glyphs
	corresponding to all characters in the element
	are treated <em>as a whole</em>;
	any overlapping portions do not increase the opacity.

	<wpt>
		opacity-overlapping-letters.html
	</wpt>

	<figure id="arabic-opacity-rendering">
		<img src="images/joining-and-transparency.svg" width=713 height=156
		alt="overlapping glyphs rendered correctly, and incorrectly">
		<figcaption>
			Correct and incorrect rendering of text
			with an 'opacity' value of less than one,
			whose glyphs overlap.
		</figcaption>
	</figure>

	If separate opacity for each glyph is desired,
	it can be achieved by using a color value
	which includes alpha,
	rather than setting the 'opacity' property.

	If a box has 'opacity' less than 1,
	it forms a <a>stacking context</a> for its children.
	(This prevents its contents from interleaving in the z-axis
	with content outside it.)

	<wpt>
		body-opacity-0-to-1-stacking-context.html
	</wpt>

	Furthermore, if the 'z-index' property applies to the box,
	the ''z-index/auto'' value is treated as ''0'' for the element;
	it is otherwise painted on the same layer within its parent stacking context
	as positioned elements with stack level 0
	(as if it were a positioned element with ''z-index:0'').

	See <a href="https://www.w3.org/TR/CSS21/visuren.html#layers">section 9.9</a>
	and <a href="https://www.w3.org/TR/CSS21/zindex.html">Appendix E</a> of [[!CSS2]]
	for more information on stacking contexts.

	These rules about z-order do not apply to SVG elements,
	since SVG has its own <a href="https://www.w3.org/TR/SVG11/render.html">rendering model</a> ([[!SVG11]], Chapter 3).

	The value of the 'opacity' property
	does <em>not</em> affect hit testing.


<!--
████████    ███     ██████    ██████   ████████ ████████
   ██      ██ ██   ██    ██  ██    ██  ██       ██     ██
   ██     ██   ██  ██        ██        ██       ██     ██
   ██    ██     ██ ██   ████ ██   ████ ██████   ██     ██
   ██    █████████ ██    ██  ██    ██  ██       ██     ██
   ██    ██     ██ ██    ██  ██    ██  ██       ██     ██
   ██    ██     ██  ██████    ██████   ████████ ████████
-->

<h3 id="tagged-images">Color Space of Tagged Images</h3>

	An <dfn export>tagged image</dfn> is an image
	that is explicitly assigned a color profile,
	as defined by the image format.
	This is usually done by including an
	International Color Consortium (ICC) profile [[!ICC]].

	For example JPEG [[JPEG]], PNG [[PNG]] and TIFF [[TIFF]]
	all specify a means to embed an ICC profile.

	Image formats may also use other, equivalent methods, often for brevity.

	For example, PNG specifies a means (the
	<a href="https://www.w3.org/TR/PNG/#11sRGB">sRGB chunk</a>)
	to explicitly tag an image as being in the sRGB color space,
	without including the sRGB ICC profile.

	Similarly, PNG specifies a compact means
	(the <a href="https://www.w3.org/TR/png-3/#cICP-chunk">cICP chunk</a>)
	to explicitly tag an image as being one of various SDR or HDR color spaces,
	such as Display P3 or BT.2100 HLG,
	without including an ICC profile.

	Tagged RGB images,
	and tagged images using a transformation of RGB such as YCbCr,
	if the color profile or other identifying information is valid,
	must be treated as being in the specified color space.

	<wpt>
		tagged-images-001.html
		tagged-images-002.html
		tagged-images-003.html
		tagged-images-004.html
	</wpt>

	<wpt pathprefix="/png">
		cicp-chunk.html
		apng/fDAT-inherits-cICP.html
	</wpt>

	For example, when a browser running on a system with a Display P3 monitor
	displays an JPEG image
	tagged as being in the ITU Rec BT.2020 [[!Rec.2020]]
	color space, it must convert the colors
	from ITU Rec BT.2020 to Display P3
	so that they display correctly.
	It must not treat the ITU Rec BT.2020 values
	as if they were Display P3 values, which would produce incorrect colors.

	If the color profile or other identifying information is invalid, the image is treated as described for [=untagged images=].

<!--
██     ██ ██    ██ ████████    ███     ██████    ██████   ████████ ████████
██     ██ ███   ██    ██      ██ ██   ██    ██  ██    ██  ██       ██     ██
██     ██ ████  ██    ██     ██   ██  ██        ██        ██       ██     ██
██     ██ ██ ██ ██    ██    ██     ██ ██   ████ ██   ████ ██████   ██     ██
██     ██ ██  ████    ██    █████████ ██    ██  ██    ██  ██       ██     ██
██     ██ ██   ███    ██    ██     ██ ██    ██  ██    ██  ██       ██     ██
 ███████  ██    ██    ██    ██     ██  ██████    ██████   ████████ ████████
-->

<h3 id='untagged'>
Color Spaces of Untagged Colors</h3>

	For compatibility, colors specified in HTML,
	and [=untagged images=] must be treated
	as being in the sRGB color space ([[!SRGB]])
	unless otherwise specified.

	<wpt>
		untagged-images-001.html
	</wpt>

	An <dfn export>untagged image</dfn> is an image that is not explicitly assigned a color profile, as defined by the image format.

	This rule does not apply to untagged videos, since
	<dfn export>untagged video</dfn> should be presumed to be in an ITU-defined color space.
	* At below 720p, it is Recommendation ITU-R BT.601 [[!ITU-R-BT.601]]
	* At 720p, it is SMPTE ST 296 (same colorimetry as 709) [[!SMPTE296]]
	* At 1080p, it is Recommendation ITU-R BT.709 [[!ITU-R-BT.709]]
	* At 4k (UHDTV) and above, it is ITU-R BT.2020 [[!Rec.2020]] for SDR video


<!--
 ██████   ███████  ██        ███████  ████████        ████████ ██    ██ ████████  ████████
██    ██ ██     ██ ██       ██     ██ ██     ██          ██     ██  ██  ██     ██ ██
██       ██     ██ ██       ██     ██ ██     ██          ██      ████   ██     ██ ██
██       ██     ██ ██       ██     ██ ████████           ██       ██    ████████  ██████
██       ██     ██ ██       ██     ██ ██   ██            ██       ██    ██        ██
██    ██ ██     ██ ██       ██     ██ ██    ██           ██       ██    ██        ██
 ██████   ███████  ████████  ███████  ██     ██          ██       ██    ██        ████████
-->

<h2 id='color-type'>
Representing Colors: the <<color>> type</h2>

<wpt title="This section describes a type, it is primarily tested where that type is used."></wpt>

	Colors in CSS are represented as a list of color components,
	also sometimes called “channels”,
	representing axises in the color space.
	Each component has a minimum and maximum value,
	and can take any value between those two.
	Additionally, every color is accompanied by
	an <dfn lt="alpha channel | alpha component" export>alpha component</dfn>,
	indicating how transparent it is,
	and thus how much of the backdrop one can see through the color.

	CSS has several syntaxes for specifying color values:
	* the sRGB [=hex color notation=]
		which represents the RGB and alpha components in hexadecimal notation
	* the various [=color functions=]
		which can represent colors using a variety of color spaces and coordinate systems
	* the constant [=named color=] keywords
	* the variable <<system-color>> keywords and ''currentColor'' keyword.

	The <dfn export>color functions</dfn>
	use CSS [=functional notation=]
	to represent colors in a variety of [=color spaces=]
	by specifying their component coordinates.
	Some of these use a <dfn export>cylindrical polar color</dfn> model,
	specifying color by a <<hue>> angle,
	a central axis representing lightness
	(black-to-white),
	and a radius representing saturation or chroma
	(how far the color is from a neutral grey).
	The others use a <dfn export>rectangular orthogonal color</dfn> model,
	specifying color using three
	orthogonal component axes.

	The [=color functions=] available in Level 4 are
	* ''rgb()'' and its ''rgba()'' alias,
		which (like the [=hex color notation=]) specify sRGB colors directly
		by their red/green/blue/alpha components.
	* ''hsl()'' and its ''hsla()'' alias,
		which specify sRGB colors
		by hue, saturation, and lightness
		using the [[#the-hsl-notation|HSL]] cylindrical coordinate model.
	* ''hwb()'',
		which specifies an sRGB color
		by hue, whiteness, and blackness
		using the [[#the-hwb-notation|HWB]] cylindrical coordinate model.
	* ''lab()'',
		which specifies a CIELAB color
		by CIE Lightness and its a- and b-axis hue coordinates
		(red/green-ness, and yellow/blue-ness)
		using the [[#cie-lab|CIE LAB rectangular coordinate model]].
	* ''lch()'' ,
		which specifies a CIELAB color
		by CIE Lightness, Chroma, and hue
		using the [[#cie-lab|CIE LCH cylindrical coordinate model]]
	* ''oklab()'',
		which specifies an Oklab color
		by Oklab Lightness and its a- and b-axis hue coordinates
		(red/green-ness, and yellow/blue-ness)
		using the [[#ok-lab|Oklab]] rectangular coordinate model.
	* ''oklch()'' ,
		which specifies an Oklab color
		by Oklab Lightness, Chroma, and hue
		using the [[#ok-lab|OkLCh]] cylindrical coordinate model.
<!--
	* ''device-cmyk()'',
		which specifies a device-specific CMYK color
		by its cyan, magenta, yellow, and black components.
-->
	* ''color()'',
		which allows specifying colors in a variety of color spaces
		including
		[[#predefined-sRGB|sRGB]],
		[[#predefined-sRGB-linear|Linear-Light sRGB]],
		[[#predefined-display-p3|Display P3]],
		[[#predefined-display-p3-linear|Linear-Light Display P3]],
		[[#predefined-a98-rgb|A98 RGB]],
		[[#predefined-prophoto-rgb|ProPhoto RGB]],
		[[#predefined-rec2020|ITU-R BT.2020-2]],
		and
		[[#predefined-xyz|CIE XYZ]].

	For easy reference in other specifications,
	<dfn export>opaque black</dfn> is defined as the color <nobr>''rgb(0 0 0 / 100%)''</nobr>;
	<dfn export>transparent black</dfn> is the same color,
	but fully transparent--
	i.e. <nobr>''rgb(0 0 0 / 0%)''</nobr>.

	<wpt>
		parsing/color-computed-named-color.html
		parsing/color-computed.html
		parsing/color-valid.html
	</wpt>

<h3 id="color-syntax">The <<color>> syntax</h3>

	<wpt title="This section provides definitions used later, it does not need tests."></wpt>

	Colors in CSS are represented by the <dfn export><<color>></dfn> type:

	<pre class='prod'>
		&lt;color> = <<color-base>> | currentColor | <<system-color>>

		<dfn>&lt;color-base></dfn> = <<hex-color>> | <<color-function>> | <<named-color>> | transparent
		<dfn export>&lt;color-function></dfn> = <<rgb()>> | <<rgba()>> |
									<<hsl()>> | <<hsla()>> | <<hwb()>> |
									<<lab()>> | <<lch()>> | <<oklab()>> | <<oklch()>> |
									<<color()>>
		</pre>

		An <dfn export>absolute color</dfn>
		is a <<color>> whose computed value
		has an absolute, colorimetric interpretation.
		This means that the value is not:

		* ''currentColor'' (which depends on the value of the 'color' property)
		* a <<system-color>> (which depends on the color mode)

	The colors that <dfn export>resolve to sRGB</dfn> are:

	- <a href="#hex-notation">hex</a> colors
	- ''rgb()'' and ''rgba()'' values
	- ''hsl()'' and ''hsla()'' values
	- ''hwb()'' values
	- <a href="#named-colors">named</a> colors

	The functions that <dfn export>support legacy color syntax</dfn> are:

	- ''rgb()'' and ''rgba()''
	- ''hsl()'' and ''hsla()''

	The <<hsl()>>, <<hsla()>>, <<hwb()>>, <<lch()>>, and <<oklch()>> [=color functions=]
	are [=cylindrical polar color=] representations using a <<hue>> angle;
	the other [=color functions=] use [=rectangular orthogonal color=] representations.

<h4 id="color-syntax-modern">
Modern (Space-separated) Color Function Syntax</h4>

	All of the [=absolute color=] functional forms
	first defined in this specification
	use the <dfn export>modern color syntax</dfn>,
	meaning:

	* color components are separated by whitespace
	* the optional alpha term is separated by a solidus ("/")
	* minimum required precision <a href="#serializing-color-values">when serializing</a> is defined,
		and may be greater than 8 bits per component
	* the ''none'' value is allowed, to represent [=missing components=]
	* components using <<percentage>> and <<number>> may be freely mixed

	<div class=example id="example-modern-syntax">
		<p>The following represents a saturated sRGB red that is 50% opaque:
		<pre>rgb(100% 0% 0% / 50%)</pre>
	</div>

<h4 id="color-syntax-legacy">
Legacy (Comma-separated) Color Function Syntax</h4>

	For Web compatibility,
	the syntactic forms
	of ''rgb()'', ''rgba()'', ''hsl()'', and ''hsla()'',
	<!-- of ''rgb()'', ''rgba()'', ''hsl()'', ''hsla()'', and ''device-cmyk()'' -->
	(those defined in earlier specifications)
	also support a
	<dfn export>legacy color syntax</dfn>
	which has the following differences:

	* color components are separated by commas
		(optionally preceded and/or followed by whitespace)
	* non-opaque forms use a separate notation
		(for example ''hsla()'' rather than ''hsl()'')
		and the alpha term is separated by  commas
		(optionally preceded and/or followed by whitespace)
	* minimum required precision is lower, 8 bits per component
	* the ''none'' value is not allowed
	* color components must be specified using either all-<<percentage>>
		or all-<<number>>, they can not be mixed.

	<div class=example id="example-rgba-legacy">
		<p>The following represents a saturated sRGB red that is 50% opaque:
		<pre>rgba(100%, 0%, 0%, 0.5)</pre>
	</div>

	For the [=color functions=] introduced
	in this or subsequent levels,
	where there is no Web compatibility issue,
	the <a>legacy color syntax</a> is invalid.

<h3 id="alpha-syntax">
Representing Transparency in Colors: the <<alpha-value>> syntax</h3>

	<wpt title="This section provides definitions used later, it does not need tests."></wpt>

	<pre class="prod">
	<dfn dfn-for="<color>">&lt;alpha-value></dfn> = <<number>> | <<percentage>>
	</pre>

	Note: This syntax is used as-is for [=legacy color syntax=].
	For [=modern color syntax=],
	it is extended
	so that alpha components
	can also take the value ''none''.

	Unless otherwise specified,
	an <<alpha-value>> component of a color defaults to ''100%'' when omitted.
	Values outside the range [0,1] are not invalid,
	but are clamped to that range at parsed-value time.

<h3 id="hue-syntax">
Representing Cylindrical-coordinate Hues: the <<hue>> syntax</h3>

	<wpt title="This section provides definitions used later, it does not need tests."></wpt>

Hue is represented as an angle of the color circle
(the rainbow, twisted around into a circle, and with purple added between violet and red).

<pre class='prod'>
	<dfn>&lt;hue></dfn> = <<number>> | <<angle>>
</pre>

Because this value is so often given in degrees,
the argument can also be given as a number,
which is interpreted as a number of degrees
and is the [=canonical unit=].

This number is normalized
to the range [0,360).

<div class="example" id="example-hue-normalization">
	For example, in <span class="swatch" style="--color: #000"></span> ''hsl(-540 0 0)''
	or <span class="swatch" style="--color: #000"></span> ''hsl(540 0 0)'',
	the <<hue>> component is normalized to 180 degrees.

	In <span class="swatch" style="--color: #000"></span> ''hsl(360 0 0)''
	the <<hue>> component is normalized to 0 degrees.

	In <span class="swatch" style="--color: #000"></span> ''hsl(calc(-infinity) 0 0)''
	or <span class="swatch" style="--color: #000"></span> ''hsl(calc(infinity) 0 0)'',
	the <<hue>> component is again normalized to 0 degrees.
</div>

Note: The angles and spacing
corresponding to particular hues
depend on the color space.
For example, in HSL and HWB, which use the sRGB color space,
sRGB green is 120 degrees.
In LCH, sRGB green is 134.39 degrees,
display-p3 green is 136.01 degrees,
a98-rgb green is 145.97 degrees
and prophoto-rgb green is 141.04 degrees
(because these are all different shades of green).

<<hue>> components are the most common components to become [=powerless=];
any color sufficiently close to the central achromatic axis
will have a [=powerless=] hue component.


<h3 id="missing">
“Missing” Color Components and the ''none'' Keyword</h3>

	In certain cases,
	a color can have one or more
	<dfn export lt="missing color component | missing | missing component">missing color components</dfn>.

	In this specification,
	this happens automatically due to [[#hue-interpolation|hue-based interpolation]]
	for some colors (such as ''white'');
	other specifications can define additional situations
	in which components are automatically missing.

	It can also be specified explicitly,
	by providing the keyword <dfn value for="<color>">none</dfn>
	for a component in a color function.
	All color functions
	(with the exception of those using the <a>legacy color syntax</a>)
	allow any of their components to be specified as ''none''.

	This should be done with care,
	and only when the particular effect of doing so is desired.

	<wpt>
		none-components-treated-as-zero.html
		parsing/color-computed-color-function.html
		parsing/color-computed-hsl.html
		parsing/color-computed-hwb.html
		parsing/color-computed-lab.html
		parsing/color-computed-relative-color.html
		parsing/color-computed-rgb.html
		parsing/color-invalid-hsl.html
		parsing/color-invalid-rgb.html
		parsing/color-valid-color-function.html
		parsing/color-valid-color-mix-function.html
		parsing/color-valid-hsl.html
		parsing/color-valid-hwb.html
		parsing/color-valid-lab.html
		parsing/color-valid-relative-color.html
		parsing/color-valid-rgb.html
	</wpt>

	For handling of [=missing components=] in
	situations which combine two colors,
	such as color interpolation,
	see [[#interpolation-missing]].

	For all other purposes, a [=missing component=] behaves as a zero value,
	in the appropriate unit for that component: ''0'', ''0%'', or ''0deg''.
	This includes rendering the color directly,
	converting it to another color space,
	performing computations on the color component values,
	etc.

	If a color with a [=missing component=] is serialized
	or otherwise presented directly to an author,
	then for <a>legacy color syntax</a>
	it represents that component as a zero value;
	otherwise,
	it represents that component as being the ''none'' keyword.

	<div class="example non-normative" id="ex-missing-hue">
		A missing hue is common when interpolating in cylindrical color spaces.
		For example, using the ''color-mix()'' function specified in [[CSS-COLOR-5]]
		one could write ''color-mix(in hsl, white 30%, green 70%)''.
		Since ''white'' is an achromatic color,
		it has a [=missing=] hue when expressed in ''hsl()''
		(effectively ''hsl(none 0% 100%))'',
		since <em>any</em> hue will produce the same color)
		which means that the color-mix function
		will treat it as having the same hue as ''green''
		(effectively ''hsl(120deg 0% 100%)''),
		and then interpolate based on those components.

		The result will be a color that truly looks like a blend of green and white,
		rather than perhaps looking reddish
		(if ''white''s hue was defaulted to ''0deg'').
	</div>

	<div class=example id="ex-grayscale-with-missing">
		Explicitly specifying missing components can be useful
		to achieve an effect where you only <em>want</em>
		to interpolate certain components of a color.

		For example, to animate a color to "grayscale", no matter what the color is,
		one can interpolate it with ''oklch(none 0 none)''.
		This will take the hue and lightness from the starting color,
		but animate its chroma down to 0,
		rendering it into an equal-lightness gray
		with a steady hue across the whole animation.

		Doing this manually would require
		matching the hue and lightness of the starting color explicitly.
	</div>


<h4 id="powerless">
“Powerless” Color Components</h4>

	Individual color syntaxes can specify that,
	in some cases,
	a given component of their syntax becomes a
	<dfn export local-lt="powerless|powerless component">powerless color component</dfn>.
	This indicates that the value of the component doesn't affect the rendered color;
	any value you give it will result in the same color displayed in the screen.

	For example, in ''hsl()'', the hue component is [=powerless=]
	when the saturation component is ''0%'';
	a ''0%'' saturation indicates a grayscale color,
	which has no hue at all,
	so ''0deg'' and ''180deg'', or any other angle,
	will give the exact same result.

	If a [=powerless component=] is manually specified,
	it acts as normal;
	the fact that it's [=powerless=] has no effect.

	However, if a color is automatically produced by color space conversion,
	then any [=powerless components=] in the result must instead be set to [=missing=],
	instead of whatever value was produced by the conversion process.

	When performing color space conversion to a [=cylindrical polar color=] space,
	user agents <em>shall</em> treat a hue component as [=powerless=]
	if the chroma (or other measure of colorfulness, such as saturation in ''hsl'')
	is less than the epsilon (ε) specified for that color space.
	For example, a gray color converted into ''oklch()'' may,
	due to numerical errors,
	have an <em>extremely small</em> chroma rather than precisely ''0%'';
	as a result, the hue component is [=powerless=].

<h3 id=parse-color>
Parsing a <<color>> Value</h3>

<wpt title="This section provides a definition referenced elsewhere, it does not need tests."></wpt>


<div algorithm>
	To <dfn export>parse a CSS <<color>> value</dfn>,
	given a [=string=] |input|,
	and an optional context <l spec=dom>[=/element=]</l> |element|:

	1. [=CSS/Parse=] |input| as a <<color>>.
		If the result is failure,
		return failure;
		otherwise, let |color| be the result.

	3. Let |used color| be the result of [[#resolving-color-values|resolving]] |color|
		to a [=used color=].
		If the value of other properties
		on the element a <<color>> is on
		is required to do the resolution
		(such as resolving a ''currentcolor'' or [=system color=]),
		use |element| if it was passed,
		or the [=initial values=] of the properties if not.

	4. Return |used color|.
</div>

Note: This algorithm is not intented
to parse a CSS <<color>> value
specified in a CSS stylesheet
or with a CSSOM interface,
but in other places
like HTML attributes or Canvas interfaces.




<!--
 ██████  ████████   ██████   ████████
██    ██ ██     ██ ██    ██  ██     ██
██       ██     ██ ██        ██     ██
 ██████  ████████  ██   ████ ████████
      ██ ██   ██   ██    ██  ██     ██
██    ██ ██    ██  ██    ██  ██     ██
 ██████  ██     ██  ██████   ████████
-->

<h2 id='numeric-srgb'>
sRGB Colors</h2>

	CSS colors in the <a>sRGB</a> color space
	are represented by a triplet of values--
	red, green, and blue--
	identifying a point in the sRGB color space [[!SRGB]].
	This is an internationally-recognized, device-independent color space,
	and so is useful for specifying colors that will be displayed on a computer screen,
	but is also useful for specifying colors on other types of devices, like printers.
	<!-- (See [[COLORIMETRY]].) broken link, find new one and fix in specref -->

	CSS also allows the use of non-sRGB [=color space=]s,
	as described in [[#predefined]].

	CSS provides several methods of directly specifying an sRGB color:
	[=hex colors=],
	''rgb()''/''rgba()'' [=color functions=],
	''hsl()''/''hsla()'' [=color functions=],
	''hwb()'' [=color function=],
	[=named colors=],
	and the ''transparent'' keyword.


<h3 id='rgb-functions'>
The RGB functions: ''rgb()'' and ''rgba()''</h3>

	The ''rgb()'' and ''rgba()'' functions define an sRGB color
	by specifying the r, g and b (red, green, and blue) components directly.
	Their syntax is:

	<pre class='prod'>
	<dfn>rgb()</dfn> = [ <<legacy-rgb-syntax>> | <<modern-rgb-syntax>> ]
	<dfn>rgba()</dfn> = [ <<legacy-rgba-syntax>> | <<modern-rgba-syntax>> ]
	<dfn><<legacy-rgb-syntax>></dfn> = 	rgb( <<percentage>>#{3} , <<alpha-value>>? ) |
										rgb( <<number>>#{3} , <<alpha-value>>? )
	<dfn><<legacy-rgba-syntax>></dfn> = rgba( <<percentage>>#{3} , <<alpha-value>>? ) |
										rgba( <<number>>#{3} , <<alpha-value>>? )
	<dfn><<modern-rgb-syntax>></dfn> = rgb(
		[ <<number>> | <<percentage>> | none]{3}
		[ / [<<alpha-value>> | none] ]?  )
	<dfn><<modern-rgba-syntax>></dfn> = rgba(
		[ <<number>> | <<percentage>> | none]{3}
		[ / [<<alpha-value>> | none] ]?  )
	</pre>

	<table id="prr-srgb">
		<tr>
			<th>Percentages</th>
			<td>Allowed for r, g and b</td>
		</tr>
		<tr>
			<th>Percent reference range&nbsp;</th>
			<td>
				For r, g and b: 0% = 0.0, 100% = 255.0
				For alpha: 0% = 0.0, 100% = 1.0
			</td>
		</tr>
	</table>

	<wpt>
		rgb-001.html
		rgb-002.html
		rgb-003.html
		rgb-004.html
		rgb-005.html
		rgb-006.html
		rgb-007.html
		rgb-008.html
		out-of-gamut-legacy-rgb.html
		parsing/color-valid.html
		parsing/color-computed-rgb.html
		parsing/color-invalid-rgb.html
		parsing/color-valid-rgb.html
	</wpt>

	The first three arguments specify the r, g and b (red, green, and blue)
	components of the color, respectively.
	''0%'' represents the minimum value for that color component in the sRGB gamut,
	and ''100%'' represents the maximum value.

	The percentage reference range of the color components comes from the historical fact that
	many graphics engines stored the color components internally as a single byte,
	which can hold integers between 0 and 255.
	Implementations should honor the precision of the component as authored or calculated wherever possible.
	If this is not possible, the component should be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>.

	The final argument, the <<alpha-value>>, specifies the alpha of the color.
	If omitted, it defaults to ''100%''.

	<wpt>
		background-color-rgb-001.html
		background-color-rgb-002.html
		background-color-rgb-003.html
		parsing/color-valid.html
	</wpt>

	Values outside these ranges are not invalid,
	but are clamped to the ranges defined here at parsed-value time.

	For historical reasons,
	''rgb()'' and ''rgba()'' also support a <a>legacy color syntax</a>.

	<wpt>
		rgba-001.html
		rgba-002.html
		rgba-003.html
		rgba-004.html
		rgba-005.html
		rgba-006.html
		rgba-007.html
		rgba-008.html
		parsing/color-valid.html
	</wpt>

<h3 id='hex-notation'>
The RGB Hexadecimal Notations: ''#RRGGBB''</h3>

	The CSS <dfn lt="hex color | hex color notation" export>hex color notation</dfn>
	allows an sRGB color to be specified by giving the components as hexadecimal numbers,
	which is similar to how colors are often written directly in computer code.
	It's also shorter than writing the same color out in ''rgb()'' notation.

	The syntax of a <dfn>&lt;hex-color></dfn> is a <<hash-token>> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
	In other words, a hex color is written as a hash character, "#",
	followed by some number of digits 0-9 or letters a-f
	(the case of the letters doesn't matter - ''#00ff00'' is identical to ''#00FF00'').

	The number of hex digits given determines how to decode the hex notation into an RGB color:

	<dl>
		<dt>6 digits
		<dd>
			The first pair of digits, interpreted as a hexadecimal number,
			specifies the red component of the color,
			where ''00'' represents the minimum value
			and ''ff'' (255 in decimal) represents the maximum.
			The next pair of digits, interpreted in the same way,
			specifies the green component,
			and the last pair specifies the blue.
			The alpha component of the color is fully opaque.

			<div class='example' id="ex-hex6">
				In other words, <span class="swatch" style="--color: #00ff00"></span>  ''#00ff00'' represents the same color as <span class="swatch" style="--color: #00ff00"></span> ''rgb(0 255 0)'' (a lime green).
			</div>

		<dt>8 digits
		<dd>
			The first 6 digits are interpreted identically to the 6-digit notation.
			The last pair of digits, interpreted as a hexadecimal number,
			specifies the alpha component of the color,
			where ''00'' represents a fully transparent color
			and ''ff'' represent a fully opaque color.

			<div class='example' id="ex-hex8">
				In other words, <span class="swatch" style="--color: #0000ffcc"></span> ''#0000ffcc'' represents the same color as <span class="swatch" style="--color: #0000ffcc"></span> ''rgb(0 0 100% / 80%)'' (a slightly-transparent blue).
			</div>

		<dt>3 digits
		<dd>
			This is a shorter variant of the 6-digit notation.
			The first digit, interpreted as a hexadecimal number,
			specifies the red component of the color,
			where ''0'' represents the minimum value
			and ''f'' represents the maximum.
			The next two digits represent the green and blue components, respectively,
			in the same way.
			The alpha component of the color is fully opaque.

			<div class='example' id="ex-hex3">
				This syntax is often explained by saying that it's identical to a 6-digit notation obtained by "duplicating" all of the digits.
				For example, the notation <span class="swatch" style="--color: #123"></span> ''#123'' specifies the same color as the notation <span class="swatch" style="--color: #123"></span> ''#112233''.
				This method of specifying a color has lower "resolution" than the 6-digit notation;
				there are only 4096 possible colors expressible in the 3-digit hex syntax,
				as opposed to approximately 17 million in 6-digit hex syntax.
			</div>

		<dt>4 digits
		<dd>
			This is a shorter variant of the 8-digit notation,
			"expanded" in the same way as the 3-digit notation is.
			The first digit, interpreted as a hexadecimal number,
			specifies the red component of the color,
			where ''0'' represents the minimum value
			and ''f'' represents the maximum.
			The next three digits represent the green, blue, and alpha components, respectively.
	</dl>

	<wpt>
		hex-001.html
		hex-002.html
		hex-003.html
		hex-004.html
		border-bottom-color.xht
		border-left-color.xht
		border-right-color.xht
		border-top-color.xht
		parsing/color-valid.html
		parsing/color-computed-hex-color.html
		parsing/color-invalid-hex-color.html
	</wpt>

<!--
██    ██    ███    ██     ██ ████████  ██████
███   ██   ██ ██   ███   ███ ██       ██    ██
████  ██  ██   ██  ████ ████ ██       ██
██ ██ ██ ██     ██ ██ ███ ██ ██████    ██████
██  ████ █████████ ██     ██ ██             ██
██   ███ ██     ██ ██     ██ ██       ██    ██
██    ██ ██     ██ ██     ██ ████████  ██████
-->

<h2 id='color-keywords'>
Color Keywords</h2>

	In addition to the various numeric syntaxes for <<color>>s,
	CSS defines several sets of color keywords that can be used instead—
	each with their own advantages or use cases.


<h3 id="named-colors">
Named Colors</h3>

	CSS defines a large set of <dfn id="named-color" lt="named color" export>named colors</dfn>,
	so that common colors can be written and read more easily.
	A <dfn>&lt;named-color></dfn> is written as an <<ident>>,
	accepted anywhere a <<color>> is.
	As usual for CSS-defined <<ident>>s,
	all of these keywords are <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a>.

	The names resolve to colors in sRGB.

	16 of CSS's named colors come from the VGA palette originally, and were then adopted into HTML:
	aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.
	Most of the rest
	come from one version of the X11 color system,
	used in Unix-derived systems to specify colors for the console,
	and were then adopted into SVG.

	Note: these color names are standardized here,
	<em>not because they are good</em>,
	but because their use and implementation has been widespread for decades
	and the standard needs to reflect reality.
	Indeed, it is often hard to imagine what each name will look like (hence the list below);
	the names are not evenly distributed throughout the sRGB color volume,
	the names are not even internally consistent
	(<span class="swatch" style="--color: darkgray"></span> ''darkgray'' is lighter than
	<span class="swatch" style="--color: gray"></span> ''gray'', while
	<span class="swatch" style="--color: lightpink"></span> ''lightpink'' is darker than
	<span class="swatch" style="--color: pink"></span> ''pink''),
	and some names
	(such as <span class="swatch" style="--color: indianred"></span> ''indianred'',
	which was originally named after a red pigment from India),
	have been found to be offensive.
	Thus, their use is <em>not encouraged</em>.


	(Two special color values, ''transparent'' and ''<color>/currentcolor'',
		are specially defined in their own sections.)

	The following table defines all of the opaque named colors,
	by giving equivalent numeric specifications in the other color syntaxes.

	<!--
		https://caniuse.com/mdn-css_types_color_rebeccapurple
	 -->

	<table class="named-color-table" dfn-type=value dfn-for="<color>, <named-color>">
		<thead>
			<tr>
				<th>Named
				<th>Numeric
				<th>Color&nbsp;name
				<th>Hex&nbsp;rgb
				<th>Decimal
		<tbody>
			<tr>
				<td style="background:aliceblue">&nbsp;<td style="background:#f0f8ff">&nbsp;<th scope=row><dfn>aliceblue</dfn><td>#f0f8ff<td>240 248 255
			<tr>
				<td style="background:antiquewhite">&nbsp;<td style="background:#faebd7">&nbsp;<th scope=row><dfn>antiquewhite</dfn><td>#faebd7<td>250 235 215
			<tr>
				<td style="background:aqua">&nbsp;<td style="background:#00ffff">&nbsp;<th scope=row><dfn>aqua</dfn><td>#00ffff<td>0 255 255
			<tr>
				<td style="background:aquamarine">&nbsp;<td style="background:#7fffd4">&nbsp;<th scope=row><dfn>aquamarine</dfn><td>#7fffd4<td>127 255 212
			<tr>
				<td style="background:azure">&nbsp;<td style="background:#f0ffff">&nbsp;<th scope=row><dfn>azure</dfn><td>#f0ffff<td>240 255 255
			<tr>
				<td style="background:beige">&nbsp;<td style="background:#f5f5dc">&nbsp;<th scope=row><dfn>beige</dfn><td>#f5f5dc<td>245 245 220
			<tr>
				<td style="background:bisque">&nbsp;<td style="background:#ffe4c4">&nbsp;<th scope=row><dfn>bisque</dfn><td>#ffe4c4<td>255 228 196
			<tr>
				<td style="background:black">&nbsp;<td style="background:#000000">&nbsp;<th scope=row><dfn>black</dfn><td>#000000<td>0 0 0
			<tr>
				<td style="background:blanchedalmond">&nbsp;<td style="background:#ffebcd">&nbsp;<th scope=row><dfn>blanchedalmond</dfn><td>#ffebcd<td>255 235 205
			<tr>
				<td style="background:blue">&nbsp;<td style="background:#0000ff">&nbsp;<th scope=row><dfn>blue</dfn><td>#0000ff<td>0 0 255
			<tr>
				<td style="background:blueviolet">&nbsp;<td style="background:#8a2be2">&nbsp;<th scope=row><dfn>blueviolet</dfn><td>#8a2be2<td>138 43 226
			<tr>
				<td style="background:brown">&nbsp;<td style="background:#a52a2a">&nbsp;<th scope=row><dfn>brown</dfn><td>#a52a2a<td>165 42 42
			<tr>
				<td style="background:burlywood">&nbsp;<td style="background:#deb887">&nbsp;<th scope=row><dfn>burlywood</dfn><td>#deb887<td>222 184 135
			<tr>
				<td style="background:cadetblue">&nbsp;<td style="background:#5f9ea0">&nbsp;<th scope=row><dfn>cadetblue</dfn><td>#5f9ea0<td>95 158 160
			<tr>
				<td style="background:chartreuse">&nbsp;<td style="background:#7fff00">&nbsp;<th scope=row><dfn>chartreuse</dfn><td>#7fff00<td>127 255 0
			<tr>
				<td style="background:chocolate">&nbsp;<td style="background:#d2691e">&nbsp;<th scope=row><dfn>chocolate</dfn><td>#d2691e<td>210 105 30
			<tr>
				<td style="background:coral">&nbsp;<td style="background:#ff7f50">&nbsp;<th scope=row><dfn>coral</dfn><td>#ff7f50<td>255 127 80
			<tr>
				<td style="background:cornflowerblue">&nbsp;<td style="background:#6495ed">&nbsp;<th scope=row><dfn>cornflowerblue</dfn><td>#6495ed<td>100 149 237
			<tr>
				<td style="background:cornsilk">&nbsp;<td style="background:#fff8dc">&nbsp;<th scope=row><dfn>cornsilk</dfn><td>#fff8dc<td>255 248 220
			<tr>
				<td style="background:crimson">&nbsp;<td style="background:#dc143c">&nbsp;<th scope=row><dfn>crimson</dfn><td>#dc143c<td>220 20 60
			<tr>
				<td style="background:cyan">&nbsp;<td style="background:#00ffff">&nbsp;<th scope=row><dfn>cyan</dfn><td>#00ffff<td>0 255 255
			<tr>
				<td style="background:darkblue">&nbsp;<td style="background:#00008b">&nbsp;<th scope=row><dfn>darkblue</dfn><td>#00008b<td>0 0 139
			<tr>
				<td style="background:darkcyan">&nbsp;<td style="background:#008b8b">&nbsp;<th scope=row><dfn>darkcyan</dfn><td>#008b8b<td>0 139 139
			<tr>
				<td style="background:darkgoldenrod">&nbsp;<td style="background:#b8860b">&nbsp;<th scope=row><dfn>darkgoldenrod</dfn><td>#b8860b<td>184 134 11
			<tr>
				<td style="background:darkgray">&nbsp;<td style="background:#a9a9a9">&nbsp;<th scope=row><dfn>darkgray</dfn><td>#a9a9a9<td>169 169 169
			<tr>
				<td style="background:darkgreen">&nbsp;<td style="background:#006400">&nbsp;<th scope=row><dfn>darkgreen</dfn><td>#006400<td>0 100 0
			<tr>
				<td style="background:darkgrey">&nbsp;<td style="background:#a9a9a9">&nbsp;<th scope=row><dfn>darkgrey</dfn><td>#a9a9a9<td>169 169 169
			<tr>
				<td style="background:darkkhaki">&nbsp;<td style="background:#bdb76b">&nbsp;<th scope=row><dfn>darkkhaki</dfn><td>#bdb76b<td>189 183 107
			<tr>
				<td style="background:darkmagenta">&nbsp;<td style="background:#8b008b">&nbsp;<th scope=row><dfn>darkmagenta</dfn><td>#8b008b<td>139 0 139
			<tr>
				<td style="background:darkolivegreen">&nbsp;<td style="background:#556b2f">&nbsp;<th scope=row><dfn>darkolivegreen</dfn><td>#556b2f<td>85 107 47
			<tr>
				<td style="background:darkorange">&nbsp;<td style="background:#ff8c00">&nbsp;<th scope=row><dfn>darkorange</dfn><td>#ff8c00<td>255 140 0
			<tr>
				<td style="background:darkorchid">&nbsp;<td style="background:#9932cc">&nbsp;<th scope=row><dfn>darkorchid</dfn><td>#9932cc<td>153 50 204
			<tr>
				<td style="background:darkred">&nbsp;<td style="background:#8b0000">&nbsp;<th scope=row><dfn>darkred</dfn><td>#8b0000<td>139 0 0
			<tr>
				<td style="background:darksalmon">&nbsp;<td style="background:#e9967a">&nbsp;<th scope=row><dfn>darksalmon</dfn><td>#e9967a<td>233 150 122
			<tr>
				<td style="background:darkseagreen">&nbsp;<td style="background:#8fbc8f">&nbsp;<th scope=row><dfn>darkseagreen</dfn><td>#8fbc8f<td>143 188 143
			<tr>
				<td style="background:darkslateblue">&nbsp;<td style="background:#483d8b">&nbsp;<th scope=row><dfn>darkslateblue</dfn><td>#483d8b<td>72 61 139
			<tr>
				<td style="background:darkslategray">&nbsp;<td style="background:#2f4f4f">&nbsp;<th scope=row><dfn>darkslategray</dfn><td>#2f4f4f<td>47 79 79
			<tr>
				<td style="background:darkslategrey">&nbsp;<td style="background:#2f4f4f">&nbsp;<th scope=row><dfn>darkslategrey</dfn><td>#2f4f4f<td>47 79 79
			<tr>
				<td style="background:darkturquoise">&nbsp;<td style="background:#00ced1">&nbsp;<th scope=row><dfn>darkturquoise</dfn><td>#00ced1<td>0 206 209
			<tr>
				<td style="background:darkviolet">&nbsp;<td style="background:#9400d3">&nbsp;<th scope=row><dfn>darkviolet</dfn><td>#9400d3<td>148 0 211
			<tr>
				<td style="background:deeppink">&nbsp;<td style="background:#ff1493">&nbsp;<th scope=row><dfn>deeppink</dfn><td>#ff1493<td>255 20 147
			<tr>
				<td style="background:deepskyblue">&nbsp;<td style="background:#00bfff">&nbsp;<th scope=row><dfn>deepskyblue</dfn><td>#00bfff<td>0 191 255
			<tr>
				<td style="background:dimgray">&nbsp;<td style="background:#696969">&nbsp;<th scope=row><dfn>dimgray</dfn><td>#696969<td>105 105 105
			<tr>
				<td style="background:dimgrey">&nbsp;<td style="background:#696969">&nbsp;<th scope=row><dfn>dimgrey</dfn><td>#696969<td>105 105 105
			<tr>
				<td style="background:dodgerblue">&nbsp;<td style="background:#1e90ff">&nbsp;<th scope=row><dfn>dodgerblue</dfn><td>#1e90ff<td>30 144 255
			<tr>
				<td style="background:firebrick">&nbsp;<td style="background:#b22222">&nbsp;<th scope=row><dfn>firebrick</dfn><td>#b22222<td>178 34 34
			<tr>
				<td style="background:floralwhite">&nbsp;<td style="background:#fffaf0">&nbsp;<th scope=row><dfn>floralwhite</dfn><td>#fffaf0<td>255 250 240
			<tr>
				<td style="background:forestgreen">&nbsp;<td style="background:#228b22">&nbsp;<th scope=row><dfn>forestgreen</dfn><td>#228b22<td>34 139 34
			<tr>
				<td style="background:fuchsia">&nbsp;<td style="background:#ff00ff">&nbsp;<th scope=row><dfn>fuchsia</dfn><td>#ff00ff<td>255 0 255
			<tr>
				<td style="background:gainsboro">&nbsp;<td style="background:#dcdcdc">&nbsp;<th scope=row><dfn>gainsboro</dfn><td>#dcdcdc<td>220 220 220
			<tr>
				<td style="background:ghostwhite">&nbsp;<td style="background:#f8f8ff">&nbsp;<th scope=row><dfn>ghostwhite</dfn><td>#f8f8ff<td>248 248 255
			<tr>
				<td style="background:gold">&nbsp;<td style="background:#ffd700">&nbsp;<th scope=row><dfn>gold</dfn><td>#ffd700<td>255 215 0
			<tr>
				<td style="background:goldenrod">&nbsp;<td style="background:#daa520">&nbsp;<th scope=row><dfn>goldenrod</dfn><td>#daa520<td>218 165 32
			<tr>
				<td style="background:gray">&nbsp;<td style="background:#808080">&nbsp;<th scope=row><dfn>gray</dfn><td>#808080<td>128 128 128
			<tr>
				<td style="background:green">&nbsp;<td style="background:#008000">&nbsp;<th scope=row><dfn>green</dfn><td>#008000<td>0 128 0
			<tr>
				<td style="background:greenyellow">&nbsp;<td style="background:#adff2f">&nbsp;<th scope=row><dfn>greenyellow</dfn><td>#adff2f<td>173 255 47
			<tr>
				<td style="background:grey">&nbsp;<td style="background:#808080">&nbsp;<th scope=row><dfn>grey</dfn><td>#808080<td>128 128 128
			<tr>
				<td style="background:honeydew">&nbsp;<td style="background:#f0fff0">&nbsp;<th scope=row><dfn>honeydew</dfn><td>#f0fff0<td>240 255 240
			<tr>
				<td style="background:hotpink">&nbsp;<td style="background:#ff69b4">&nbsp;<th scope=row><dfn>hotpink</dfn><td>#ff69b4<td>255 105 180
			<tr>
				<td style="background:indianred">&nbsp;<td style="background:#cd5c5c">&nbsp;<th scope=row><dfn>indianred</dfn><td>#cd5c5c<td>205 92 92
			<tr>
				<td style="background:indigo">&nbsp;<td style="background:#4b0082">&nbsp;<th scope=row><dfn>indigo</dfn><td>#4b0082<td>75 0 130
			<tr>
				<td style="background:ivory">&nbsp;<td style="background:#fffff0">&nbsp;<th scope=row><dfn>ivory</dfn><td>#fffff0<td>255 255 240
			<tr>
				<td style="background:khaki">&nbsp;<td style="background:#f0e68c">&nbsp;<th scope=row><dfn>khaki</dfn><td>#f0e68c<td>240 230 140
			<tr>
				<td style="background:lavender">&nbsp;<td style="background:#e6e6fa">&nbsp;<th scope=row><dfn>lavender</dfn><td>#e6e6fa<td>230 230 250
			<tr>
				<td style="background:lavenderblush">&nbsp;<td style="background:#fff0f5">&nbsp;<th scope=row><dfn>lavenderblush</dfn><td>#fff0f5<td>255 240 245
			<tr>
				<td style="background:lawngreen">&nbsp;<td style="background:#7cfc00">&nbsp;<th scope=row><dfn>lawngreen</dfn><td>#7cfc00<td>124 252 0
			<tr>
				<td style="background:lemonchiffon">&nbsp;<td style="background:#fffacd">&nbsp;<th scope=row><dfn>lemonchiffon</dfn><td>#fffacd<td>255 250 205
			<tr>
				<td style="background:lightblue">&nbsp;<td style="background:#add8e6">&nbsp;<th scope=row><dfn>lightblue</dfn><td>#add8e6<td>173 216 230
			<tr>
				<td style="background:lightcoral">&nbsp;<td style="background:#f08080">&nbsp;<th scope=row><dfn>lightcoral</dfn><td>#f08080<td>240 128 128
			<tr>
				<td style="background:lightcyan">&nbsp;<td style="background:#e0ffff">&nbsp;<th scope=row><dfn>lightcyan</dfn><td>#e0ffff<td>224 255 255
			<tr>
				<td style="background:lightgoldenrodyellow">&nbsp;<td style="background:#fafad2">&nbsp;<th scope=row><dfn>lightgoldenrodyellow</dfn><td>#fafad2<td>250 250 210
			<tr>
				<td style="background:lightgray">&nbsp;<td style="background:#d3d3d3">&nbsp;<th scope=row><dfn>lightgray</dfn><td>#d3d3d3<td>211 211 211
			<tr>
				<td style="background:lightgreen">&nbsp;<td style="background:#90ee90">&nbsp;<th scope=row><dfn>lightgreen</dfn><td>#90ee90<td>144 238 144
			<tr>
				<td style="background:lightgrey">&nbsp;<td style="background:#d3d3d3">&nbsp;<th scope=row><dfn>lightgrey</dfn><td>#d3d3d3<td>211 211 211
			<tr>
				<td style="background:lightpink">&nbsp;<td style="background:#ffb6c1">&nbsp;<th scope=row><dfn>lightpink</dfn><td>#ffb6c1<td>255 182 193
			<tr>
				<td style="background:lightsalmon">&nbsp;<td style="background:#ffa07a">&nbsp;<th scope=row><dfn>lightsalmon</dfn><td>#ffa07a<td>255 160 122
			<tr>
				<td style="background:lightseagreen">&nbsp;<td style="background:#20b2aa">&nbsp;<th scope=row><dfn>lightseagreen</dfn><td>#20b2aa<td>32 178 170
			<tr>
				<td style="background:lightskyblue">&nbsp;<td style="background:#87cefa">&nbsp;<th scope=row><dfn>lightskyblue</dfn><td>#87cefa<td>135 206 250
			<tr>
				<td style="background:lightslategray">&nbsp;<td style="background:#778899">&nbsp;<th scope=row><dfn>lightslategray</dfn><td>#778899<td>119 136 153
			<tr>
				<td style="background:lightslategrey">&nbsp;<td style="background:#778899">&nbsp;<th scope=row><dfn>lightslategrey</dfn><td>#778899<td>119 136 153
			<tr>
				<td style="background:lightsteelblue">&nbsp;<td style="background:#b0c4de">&nbsp;<th scope=row><dfn>lightsteelblue</dfn><td>#b0c4de<td>176 196 222
			<tr>
				<td style="background:lightyellow">&nbsp;<td style="background:#ffffe0">&nbsp;<th scope=row><dfn>lightyellow</dfn><td>#ffffe0<td>255 255 224
			<tr>
				<td style="background:lime">&nbsp;<td style="background:#00ff00">&nbsp;<th scope=row><dfn>lime</dfn><td>#00ff00<td>0 255 0
			<tr>
				<td style="background:limegreen">&nbsp;<td style="background:#32cd32">&nbsp;<th scope=row><dfn>limegreen</dfn><td>#32cd32<td>50 205 50
			<tr>
				<td style="background:linen">&nbsp;<td style="background:#faf0e6">&nbsp;<th scope=row><dfn>linen</dfn><td>#faf0e6<td>250 240 230
			<tr>
				<td style="background:magenta">&nbsp;<td style="background:#ff00ff">&nbsp;<th scope=row><dfn>magenta</dfn><td>#ff00ff<td>255 0 255
			<tr>
				<td style="background:maroon">&nbsp;<td style="background:#800000">&nbsp;<th scope=row><dfn>maroon</dfn><td>#800000<td>128 0 0
			<tr>
				<td style="background:mediumaquamarine">&nbsp;<td style="background:#66cdaa">&nbsp;<th scope=row><dfn>mediumaquamarine</dfn><td>#66cdaa<td>102 205 170
			<tr>
				<td style="background:mediumblue">&nbsp;<td style="background:#0000cd">&nbsp;<th scope=row><dfn>mediumblue</dfn><td>#0000cd<td>0 0 205
			<tr>
				<td style="background:mediumorchid">&nbsp;<td style="background:#ba55d3">&nbsp;<th scope=row><dfn>mediumorchid</dfn><td>#ba55d3<td>186 85 211
			<tr>
				<td style="background:mediumpurple">&nbsp;<td style="background:#9370db">&nbsp;<th scope=row><dfn>mediumpurple</dfn><td>#9370db<td>147 112 219
			<tr>
				<td style="background:mediumseagreen">&nbsp;<td style="background:#3cb371">&nbsp;<th scope=row><dfn>mediumseagreen</dfn><td>#3cb371<td>60 179 113
			<tr>
				<td style="background:mediumslateblue">&nbsp;<td style="background:#7b68ee">&nbsp;<th scope=row><dfn>mediumslateblue</dfn><td>#7b68ee<td>123 104 238
			<tr>
				<td style="background:mediumspringgreen">&nbsp;<td style="background:#00fa9a">&nbsp;<th scope=row><dfn>mediumspringgreen</dfn><td>#00fa9a<td>0 250 154
			<tr>
				<td style="background:mediumturquoise">&nbsp;<td style="background:#48d1cc">&nbsp;<th scope=row><dfn>mediumturquoise</dfn><td>#48d1cc<td>72 209 204
			<tr>
				<td style="background:mediumvioletred">&nbsp;<td style="background:#c71585">&nbsp;<th scope=row><dfn>mediumvioletred</dfn><td>#c71585<td>199 21 133
			<tr>
				<td style="background:midnightblue">&nbsp;<td style="background:#191970">&nbsp;<th scope=row><dfn>midnightblue</dfn><td>#191970<td>25 25 112
			<tr>
				<td style="background:mintcream">&nbsp;<td style="background:#f5fffa">&nbsp;<th scope=row><dfn>mintcream</dfn><td>#f5fffa<td>245 255 250
			<tr>
				<td style="background:mistyrose">&nbsp;<td style="background:#ffe4e1">&nbsp;<th scope=row><dfn>mistyrose</dfn><td>#ffe4e1<td>255 228 225
			<tr>
				<td style="background:moccasin">&nbsp;<td style="background:#ffe4b5">&nbsp;<th scope=row><dfn>moccasin</dfn><td>#ffe4b5<td>255 228 181
			<tr>
				<td style="background:navajowhite">&nbsp;<td style="background:#ffdead">&nbsp;<th scope=row><dfn>navajowhite</dfn><td>#ffdead<td>255 222 173
			<tr>
				<td style="background:navy">&nbsp;<td style="background:#000080">&nbsp;<th scope=row><dfn>navy</dfn><td>#000080<td>0 0 128
			<tr>
				<td style="background:oldlace">&nbsp;<td style="background:#fdf5e6">&nbsp;<th scope=row><dfn>oldlace</dfn><td>#fdf5e6<td>253 245 230
			<tr>
				<td style="background:olive">&nbsp;<td style="background:#808000">&nbsp;<th scope=row><dfn>olive</dfn><td>#808000<td>128 128 0
			<tr>
				<td style="background:olivedrab">&nbsp;<td style="background:#6b8e23">&nbsp;<th scope=row><dfn>olivedrab</dfn><td>#6b8e23<td>107 142 35
			<tr>
				<td style="background:orange">&nbsp;<td style="background:#ffa500">&nbsp;<th scope=row><dfn>orange</dfn><td>#ffa500<td>255 165 0
			<tr>
				<td style="background:orangered">&nbsp;<td style="background:#ff4500">&nbsp;<th scope=row><dfn>orangered</dfn><td>#ff4500<td>255 69 0
			<tr>
				<td style="background:orchid">&nbsp;<td style="background:#da70d6">&nbsp;<th scope=row><dfn>orchid</dfn><td>#da70d6<td>218 112 214
			<tr>
				<td style="background:palegoldenrod">&nbsp;<td style="background:#eee8aa">&nbsp;<th scope=row><dfn>palegoldenrod</dfn><td>#eee8aa<td>238 232 170
			<tr>
				<td style="background:palegreen">&nbsp;<td style="background:#98fb98">&nbsp;<th scope=row><dfn>palegreen</dfn><td>#98fb98<td>152 251 152
			<tr>
				<td style="background:paleturquoise">&nbsp;<td style="background:#afeeee">&nbsp;<th scope=row><dfn>paleturquoise</dfn><td>#afeeee<td>175 238 238
			<tr>
				<td style="background:palevioletred">&nbsp;<td style="background:#db7093">&nbsp;<th scope=row><dfn>palevioletred</dfn><td>#db7093<td>219 112 147
			<tr>
				<td style="background:papayawhip">&nbsp;<td style="background:#ffefd5">&nbsp;<th scope=row><dfn>papayawhip</dfn><td>#ffefd5<td>255 239 213
			<tr>
				<td style="background:peachpuff">&nbsp;<td style="background:#ffdab9">&nbsp;<th scope=row><dfn>peachpuff</dfn><td>#ffdab9<td>255 218 185
			<tr>
				<td style="background:peru">&nbsp;<td style="background:#cd853f">&nbsp;<th scope=row><dfn>peru</dfn><td>#cd853f<td>205 133 63
			<tr>
				<td style="background:pink">&nbsp;<td style="background:#ffc0cb">&nbsp;<th scope=row><dfn>pink</dfn><td>#ffc0cb<td>255 192 203
			<tr>
				<td style="background:plum">&nbsp;<td style="background:#dda0dd">&nbsp;<th scope=row><dfn>plum</dfn><td>#dda0dd<td>221 160 221
			<tr>
				<td style="background:powderblue">&nbsp;<td style="background:#b0e0e6">&nbsp;<th scope=row><dfn>powderblue</dfn><td>#b0e0e6<td>176 224 230
			<tr>
				<td style="background:purple">&nbsp;<td style="background:#800080">&nbsp;<th scope=row><dfn>purple</dfn><td>#800080<td>128 0 128
			<tr>
				<td style="background:rebeccapurple">&nbsp;<td style="background:#663399">&nbsp;<th scope=row><dfn>rebeccapurple</dfn><td>#663399<td>102 51 153
			<tr>
				<td style="background:red">&nbsp;<td style="background:#ff0000">&nbsp;<th scope=row><dfn>red</dfn><td>#ff0000<td>255 0 0
			<tr>
				<td style="background:rosybrown">&nbsp;<td style="background:#bc8f8f">&nbsp;<th scope=row><dfn>rosybrown</dfn><td>#bc8f8f<td>188 143 143
			<tr>
				<td style="background:royalblue">&nbsp;<td style="background:#4169e1">&nbsp;<th scope=row><dfn>royalblue</dfn><td>#4169e1<td>65 105 225
			<tr>
				<td style="background:saddlebrown">&nbsp;<td style="background:#8b4513">&nbsp;<th scope=row><dfn>saddlebrown</dfn><td>#8b4513<td>139 69 19
			<tr>
				<td style="background:salmon">&nbsp;<td style="background:#fa8072">&nbsp;<th scope=row><dfn>salmon</dfn><td>#fa8072<td>250 128 114
			<tr>
				<td style="background:sandybrown">&nbsp;<td style="background:#f4a460">&nbsp;<th scope=row><dfn>sandybrown</dfn><td>#f4a460<td>244 164 96
			<tr>
				<td style="background:seagreen">&nbsp;<td style="background:#2e8b57">&nbsp;<th scope=row><dfn>seagreen</dfn><td>#2e8b57<td>46 139 87
			<tr>
				<td style="background:seashell">&nbsp;<td style="background:#fff5ee">&nbsp;<th scope=row><dfn>seashell</dfn><td>#fff5ee<td>255 245 238
			<tr>
				<td style="background:sienna">&nbsp;<td style="background:#a0522d">&nbsp;<th scope=row><dfn>sienna</dfn><td>#a0522d<td>160 82 45
			<tr>
				<td style="background:silver">&nbsp;<td style="background:#c0c0c0">&nbsp;<th scope=row><dfn>silver</dfn><td>#c0c0c0<td>192 192 192
			<tr>
				<td style="background:skyblue">&nbsp;<td style="background:#87ceeb">&nbsp;<th scope=row><dfn>skyblue</dfn><td>#87ceeb<td>135 206 235
			<tr>
				<td style="background:slateblue">&nbsp;<td style="background:#6a5acd">&nbsp;<th scope=row><dfn>slateblue</dfn><td>#6a5acd<td>106 90 205
			<tr>
				<td style="background:slategray">&nbsp;<td style="background:#708090">&nbsp;<th scope=row><dfn>slategray</dfn><td>#708090<td>112 128 144
			<tr>
				<td style="background:slategrey">&nbsp;<td style="background:#708090">&nbsp;<th scope=row><dfn>slategrey</dfn><td>#708090<td>112 128 144
			<tr>
				<td style="background:snow">&nbsp;<td style="background:#fffafa">&nbsp;<th scope=row><dfn>snow</dfn><td>#fffafa<td>255 250 250
			<tr>
				<td style="background:springgreen">&nbsp;<td style="background:#00ff7f">&nbsp;<th scope=row><dfn>springgreen</dfn><td>#00ff7f<td>0 255 127
			<tr>
				<td style="background:steelblue">&nbsp;<td style="background:#4682b4">&nbsp;<th scope=row><dfn>steelblue</dfn><td>#4682b4<td>70 130 180
			<tr>
				<td style="background:tan">&nbsp;<td style="background:#d2b48c">&nbsp;<th scope=row><dfn>tan</dfn><td>#d2b48c<td>210 180 140
			<tr>
				<td style="background:teal">&nbsp;<td style="background:#008080">&nbsp;<th scope=row><dfn>teal</dfn><td>#008080<td>0 128 128
			<tr>
				<td style="background:thistle">&nbsp;<td style="background:#d8bfd8">&nbsp;<th scope=row><dfn>thistle</dfn><td>#d8bfd8<td>216 191 216
			<tr>
				<td style="background:tomato">&nbsp;<td style="background:#ff6347">&nbsp;<th scope=row><dfn>tomato</dfn><td>#ff6347<td>255 99 71
			<tr>
				<td style="background:turquoise">&nbsp;<td style="background:#40e0d0">&nbsp;<th scope=row><dfn>turquoise</dfn><td>#40e0d0<td>64 224 208
			<tr>
				<td style="background:violet">&nbsp;<td style="background:#ee82ee">&nbsp;<th scope=row><dfn>violet</dfn><td>#ee82ee<td>238 130 238
			<tr>
				<td style="background:wheat">&nbsp;<td style="background:#f5deb3">&nbsp;<th scope=row><dfn>wheat</dfn><td>#f5deb3<td>245 222 179
			<tr>
				<td style="background:white">&nbsp;<td style="background:#ffffff">&nbsp;<th scope=row><dfn>white</dfn><td>#ffffff<td>255 255 255
			<tr>
				<td style="background:whitesmoke">&nbsp;<td style="background:#f5f5f5">&nbsp;<th scope=row><dfn>whitesmoke</dfn><td>#f5f5f5<td>245 245 245
			<tr>
				<td style="background:yellow">&nbsp;<td style="background:#ffff00">&nbsp;<th scope=row><dfn>yellow</dfn><td>#ffff00<td>255 255 0
			<tr>
				<td style="background:yellowgreen">&nbsp;<td style="background:#9acd32">&nbsp;<th scope=row><dfn>yellowgreen</dfn><td>#9acd32<td>154 205 50
	</table>

	Note: this list of colors and their definitions is a superset of the list of <a href="https://www.w3.org/TR/SVG11/types.html#ColorKeywords">named colors defined by SVG 1.1</a>.
For historical reasons, this is also referred to as the X11 color set.

Note: The history of the X11 color system is interesting,
	and was excellently summarized by
	<a href="https://www.youtube.com/watch?v=HmStJQzclHc">Alex Sexton in their talk “Peachpuffs and Lemonchiffons”</a>.

<wpt>
named-001.html
parsing/color-valid.html
parsing/color-computed-named-color.html
parsing/color-invalid-named-color.html
</wpt>

<h3 id="css-system-colors" dfn export lt="system colors">
System Colors</h3>

	In general, the <<system-color>> keywords
	reflect <em>default</em> color choices made by the user, the browser, or the OS.
	They are typically used in the browser default stylesheet, for this reason.

	To maintain legibility,
	the <<system-color>> keywords also respond to
	the [=element color scheme=].


	<div class="example" id="ex-LM-DM-links">
		For example, traditional <span class="swatch" style="--color: blue"></span>  blue link text is legible on a <span class="swatch" style="--color: #fff"></span> white background
	(WCAG contrast 8.59:1, AAA pass)
	but would not be legible on a <span class="swatch" style="--color: #000"></span>  black background
	(WCAG contrast 2.44:1, AA fail).
	Instead, a lighter blue such as <span class="swatch" style="--color: #81D9FE"></span>  #81D9FE would be used in dark mode
	(WCAG contrast 13.28:1, AAA pass).
		<div style="margin:1em; margin-left: 2em; text-decoration: underline; background: inherit">
		<p style="padding: 4px; background-color: white; color: blue"> Legible link text</p>
		<p style="padding: 4px; background-color: black; color: blue"> Illegible link text</p>
		<p style="padding: 4px; background-color: black; color: #81D9FE"> Legible link text</p>
		</div>
	</div>

	However, in [=forced colors mode=],
	most colors on the page are forced into a restricted, user-chosen palette,
	see [[css-color-adjust-1#forced-color-palettes]].
	The <dfn>&lt;system-color></dfn> keywords
	expose these user-chosen colors
	so that the rest of the page can integrate with this restricted palette.

	When the <a href="https://drafts.csswg.org/mediaqueries-5/#descdef-media-forced-colors">forced-colors</a> [=media feature=] is ''forced-colors/active'',
	authors <em>should</em> use the <<system-color>> keywords as color values
	in properties other than those listed in [[css-color-adjust-1#forced-colors-properties]],
	to ensure legibility and consistency across the page
	and avoid an uncoordinated mishmash of user-forced and page-chosen colors.

	<wpt>
	system-color-consistency.html
	system-color-support.html
	parsing/color-valid-system-color.html
	</wpt>

	When the values of <<system-color>> keywords come from the browser,
	(as opposed to being OS defaults or user choices) the browser should
	ensure that <a href="#system-color-pairs">matching
	foreground/background pairs</a> have a minimum
	of WCAG AA contrast.
	However, user preferences (for higher or lower contrast),
	whether set as a browser preference, a user stylesheet,
	or by altering the OS defaults,
	must take precedence over this requirement.

	Authors <em>may</em> also use these keywords at any time,
	but <em>should</em> be careful to use the colors
	in <a href="#system-color-pairs">matching background-foreground pairs</a>
	to ensure appropriate contrast,
	as any particular contrast relationship across non-matching pairs
	(e.g. ''Canvas'' and ''ButtonText'')
	is not guaranteed.

	The <<system-color>> keywords are defined as follows:

	<dl id="system-color-values" data-dfn-type="value" dfn-for="<color>, <system-color>">
		<dt><dfn>AccentColor</dfn>
			<dd><span class="swatch" style="--color: accentcolor"></span>&nbsp;Background of accented user interface controls.
		<dt><dfn>AccentColorText</dfn>
			<dd><span class="swatch" style="--color: accentcolortext"></span>&nbsp;Text of accented user interface controls.
		<dt><dfn>ActiveText</dfn>
			<dd><span class="swatch" style="--color: activetext"></span>&nbsp;Text in active links. For light backgrounds, traditionally red.
		<dt><dfn>ButtonBorder</dfn>
			<dd><span class="swatch" style="--color: buttonborder"></span>&nbsp;The base border color for push buttons.
		<dt><dfn>ButtonFace</dfn>
			<dd><span class="swatch" style="--color: buttonface"></span>&nbsp;The face background color for push buttons.
		<dt><dfn>ButtonText</dfn>
			<dd><span class="swatch" style="--color: buttontext"></span>&nbsp;Text on push buttons.
		<dt><dfn>Canvas</dfn>
			<dd><span class="swatch" style="--color: canvas"></span>&nbsp;Background of application content or documents.
		<dt><dfn>CanvasText</dfn>
			<dd><span class="swatch" style="--color: canvastext"></span>&nbsp;Text in application content or documents.
		<dt><dfn>Field</dfn>
			<dd><span class="swatch" style="--color: field"></span>&nbsp;Background of input fields.
		<dt><dfn>FieldText</dfn>
			<dd><span class="swatch" style="--color: fieldtext"></span>&nbsp;Text in input fields.
		<dt><dfn>GrayText</dfn>
			<dd><span class="swatch" style="--color: graytext"></span>&nbsp;Disabled text.
				(Often, but not necessarily, gray.)
		<dt><dfn>Highlight</dfn>
			<dd><span class="swatch" style="--color: highlight"></span>&nbsp;Background of selected text, for example from ::selection.
		<dt><dfn>HighlightText</dfn>
			<dd><span class="swatch" style="--color: highlighttext"></span>&nbsp;Text of selected text.
		<dt><dfn>LinkText</dfn>
			<dd><span class="swatch" style="--color: linktext"></span>&nbsp;Text in non-active, non-visited links. For light backgrounds, traditionally blue.
		<dt><dfn>Mark</dfn>
			<dd><span class="swatch" style="--color: mark"></span>&nbsp;Background of text that has been specially marked
				(such as by the HTML <{mark}> element).
		<dt><dfn>MarkText</dfn>
			<dd><span class="swatch" style="--color: marktext"></span>&nbsp;Text that has been specially marked
				(such as by the HTML <{mark}> element).
		<dt><dfn>SelectedItem</dfn>
			<dd><span class="swatch" style="--color: selecteditem"></span>&nbsp;Background of selected items, for example a selected checkbox.
		<dt><dfn>SelectedItemText</dfn>
			<dd><span class="swatch" style="--color: selecteditemtext"></span>&nbsp;Text of selected items.
		<dt><dfn>VisitedText</dfn>
			<dd><span class="swatch" style="--color: visitedtext"></span>&nbsp;Text in visited links. For light backgrounds, traditionally purple.
	</dl>

	<wpt>
		parsing/color-valid.html
		relative-currentcolor-visited-getcomputedstyle.html
		system-color-compute.html
		system-color-hightlights-vs-getSelection-001.html
		system-color-hightlights-vs-getSelection-002.html
	</wpt>

	Note: As with all other [=CSS/keywords=],
	these names are <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a>.
	They are shown here with mixed capitalization for legibility.

	For systems that do not have a particular system UI concept,
	the specified value should be mapped to
	the most closely related system color value that exists.
	The following <dfn export>system color pairings</dfn> are expected to form legible background-foreground colors:

	<ul id=system-color-pairs>
		* ''Canvas'' background with ''CanvasText'', ''LinkText'', ''VisitedText'', ''ActiveText'' foreground.
		* ''Canvas'' background with a ''ButtonBorder'' border and adjacent color ''Canvas''
		* ''ButtonFace'' background with ''ButtonText'' foreground.
		* ''Field'' background with ''FieldText'' foreground.
		* ''Mark'' background with ''MarkText'' foreground
		* ''ButtonFace'' or ''Field'' background with a ''ButtonBorder'' border and adjacent color ''Canvas'''
		* ''Highlight'' background with ''HighlightText'' foreground.
		* ''SelectedItem'' background with ''SelectedItemText'' foreground.
		* ''AccentColor'' background with ''AccentColorText'' foreground.
	</ul>

	Additionally, ''GrayText'' is expected to be readable,
	though possibly at a lower contrast rating,
	over any of the backgrounds.

	To maintain consistency with widget [=accent color=] styling,
	''AccentColor'' takes its value from 'accent-color',
	unless [=Forced Colors Mode=] is enabled.
	''AccentColorText'' takes its value from
	the contrasting foreground color to ''AccentColor''
	as is described for widget [=accent color=] styling.

	<div class="example" id="ex-SystemCombo">
		For example, the system color combinations in the browser you are currently using:

		<p>Canvas with CanvasText: <span style="background-color:Canvas; color:CanvasText">CanvasText</span></p>
		<p>Canvas with LinkText: <span style="background-color:Canvas; color:LinkText">LinkText</span></p>
		<p>Canvas with VisitedText: <span style="background-color:Canvas; color:VisitedText">VisitedText</span></p>
		<p>Canvas with ActiveText: <span style="background-color:Canvas; color:ActiveText">ActiveText</span></p>
		<p>Canvas with GrayText: <span style="background-color:Canvas; color:GrayText">GrayText</span></p>
		<p>Canvas with ButtonBorder and adjacent Canvas: <span style="background-color:Canvas; border: ButtonBorder; color:CanvasText; padding: 3px">CanvasText</span><span style="background-color:Canvas; color:CanvasText">Adjacent</span></p>
		<p>ButtonFace with ButtonText: <span style="background-color:ButtonFace; color:ButtonText">ButtonText</span></p>
		<p>ButtonFace with ButtonText and ButtonBorder: <span style="background-color:ButtonFace; color:ButtonText; border:ButtonBorder; padding: 3px">ButtonText</span></p>
		<p>ButtonFace with GrayText: <span style="background-color:ButtonFace; color:GrayText">GrayText</span></p>
		<p>Field with FieldText: <span style="background-color:Field; color:FieldText">FieldText</span></p>
		<p>Field with GrayText: <span style="background-color:Field; color:GrayText">GrayText</span></p>
		<p>Mark with MarkText: <span style="background-color:Mark; color:MarkText">MarkText</span></p>
		<p>Mark with GrayText: <span style="background-color:Mark; color:GrayText">GrayText</span></p>
		<p>Highlight with HighlightText: <span style="background-color:Highlight; color:HighlightText">HighlightText</span></p>
		<p>Highlight with GrayText: <span style="background-color:Highlight; color:GrayText">GrayText</span></p>
		<p>SelectedItem with SelectedItemText: <span style="background-color:SelectedItem; color:SelectedItemText">SelectedItemText</span></p>
		<p>AccentColor with AccentColorText: <span style="background-color:AccentColor; color:AccentColorText">AccentColorText</span></p>
		<p>AccentColor with GrayText: <span style="background-color:AccentColor; color:GrayText">GrayText</span></p>
	</div>

	Earlier versions of CSS defined additional <<system-color>>s,
	which have since been deprecated.
	These are documented in [[#deprecated-system-colors]].

	Note: The <<system-color>>s incur some privacy and security risk, as detailed in [[#privacy]] and [[#security]].

	User agents may,
	to mitigate privacy and security risks such as fingerprinting,
	elect to return fixed values for the used value of system colors
	which do not reflect customisation or theming choices
	made by the user.


<h3 id='transparent-color'>
The ''transparent'' keyword</h3>

	The keyword <dfn value for="<color>">transparent</dfn> specifies a <a>transparent black</a>.
	It is a type of <<named-color>>.

<wpt>
	parsing/color-computed.html
	parsing/color-valid.html
	t423-transparent-1-a.xht
	t423-transparent-2-a.xht

</wpt>


<h3 id='currentcolor-color'>
The ''<color>/currentcolor'' keyword</h3>

	The keyword <dfn value for="<color>">currentcolor</dfn> represents value of the 'color' property on the same element.
	Unlike <<named-color>>s, it is <em>not</em> restricted to sRGB;
	the value can be any <<color>>.
	Its <a>used values</a> is determined by <a href="#resolving-other-colors">resolving color values</a>.

	<wpt>
		border-color-currentcolor.html
		color-mix-currentcolor-nested-for-color-property.html
		currentcolor-001.html
		currentcolor-002.html
		currentcolor-003.html
		currentcolor-004.html
		currentcolor-visited-fallback.html
		parsing/color-valid.html
	</wpt>

	<div class='example' id="ex-currentcolor">
		Here's a simple example showing how to use the ''<color>/currentcolor'' keyword:

		<pre class="lang-css">
		.foo {
			color: <span class="swatch" style="--color: red"></span>&nbsp;red;
			background-color: <span class="swatch" style="--color: red"></span>&nbsp;currentcolor;
		}
		</pre>

		This is equivalent to writing:

		<pre class="lang-css">
		.foo {
			color: <span class="swatch" style="--color: red"></span>&nbsp;red;
			background-color: <span class="swatch" style="--color: red"></span>&nbsp;red;
		}
		</pre>
	</div>

	<div class='example' id="ex-textemph-currentcolor">
		For example, the 'text-emphasis-color' property [[CSS3-TEXT-DECOR]],
		whose initial value is ''<color>/currentcolor'',
		by default matches the text color
		even as the 'color' property changes across elements.

		<pre class="language-markup">
			&lt;p>&lt;em>Some &lt;strong>really&lt;/strong> emphasized text.&lt;/em>
			&lt;style>
			p { color: black; }
			em { text-emphasis: dot; }
			strong { color: red; }
			&lt;/style>
		</pre>

		<p><img src="images/text-emphasis.png" width="495" height="119" alt="rendered emphasized text with the word 'really' in red with red emphasis dots"></p>

		In the above example, the emphasis marks are black over the text "Some" and "emphasized text",
		but red over the text "really".
	</div>

	<p class="note" id="trivia" role="note"><span class="marker">Note:</span>
	Multi-word keywords in CSS usually separate their component words with hyphens.
	''<color>/currentcolor'' doesn't, because (deep breath)
	it was originally introduced in SVG
	as a property value, "current-color" with the usual CSS spelling.
	It (along with all other properties and their values)
	then became presentation attributes and attribute values,
	as well as properties,
	to make generation with XSLT easier.
	Then all of the presentation attributes were changed
	from hyphenated to camelCase, because the DOM
	had an issue with hyphen meaning "minus".
	But then, they didn't follow CSS conventions
	anymore so all the properties and property values
	that were <em>already</em> part of CSS were changed back to hyphenated!
	''<color>/currentcolor'' was not a part of CSS at that time,
	so remained camelCased.
	Only later did CSS pick it up,
	at which point the capitalization stopped mattering,
	as CSS keywords are <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a>.

	</p>

<!--
██     ██  ██████  ██
██     ██ ██    ██ ██
██     ██ ██       ██
█████████  ██████  ██
██     ██       ██ ██
██     ██ ██    ██ ██
██     ██  ██████  ████████
-->

<h2 id='the-hsl-notation'>
HSL Colors: ''hsl()'' and ''hsla()'' functions</h2>

	The RGB system for specifying colors,
	while convenient for machines and graphic libraries,
	is often regarded as very difficult for humans to gain an intuitive grasp on.
	It's not easy to tell, for example,
	how to alter an RGB color to produce a lighter variant of the same hue.

	There are several other color schemes possible.
	One such is the HSL [[!HSL]] color scheme,
	which is more intuitive to use,
	but still maps easily back to RGB colors.

	<dfn value export for="hsl()">HSL</dfn> colors are specified
	as a triplet of hue, saturation, and lightness.
	The syntax of the ''hsl()'' and ''hsla()'' functions is:

	<pre class='prod'>
	<dfn>hsl()</dfn> = [ <<legacy-hsl-syntax>> | <<modern-hsl-syntax>> ]
	<dfn>hsla()</dfn> = [ <<legacy-hsla-syntax>> | <<modern-hsla-syntax>> ]
	<dfn><<modern-hsl-syntax>></dfn> = hsl(
			[<<hue>> | none]
			[<<percentage>> | <<number>> | none]
			[<<percentage>> | <<number>> | none]
			[ / [<<alpha-value>> | none] ]? )
	<dfn><<modern-hsla-syntax>></dfn> = hsla(
			[<<hue>> | none]
			[<<percentage>> | <<number>> | none]
			[<<percentage>> | <<number>> | none]
			[ / [<<alpha-value>> | none] ]? )
	<dfn><<legacy-hsl-syntax>></dfn> = hsl( <<hue>>, <<percentage>>, <<percentage>>, <<alpha-value>>? )
	<dfn><<legacy-hsla-syntax>></dfn> = hsla( <<hue>>, <<percentage>>, <<percentage>>, <<alpha-value>>? )
	</pre>

	<table id="prr-hsl">
		<tr>
			<th>Percentages</th>
			<td>Allowed for S and L</td>
		</tr>
		<tr>
			<th>Percent reference range&nbsp;</th>
			<td>
				for S and L: 0% = 0.0, 100% = 100.0
			</td>
		</tr>
		<tr>
			<th>Powerless hue ε</th>
			<td>S &lt;= 0.001</td>
		</tr>
	</table>

	<wpt>
		hsl-001.html
		hsl-002.html
		hsl-003.html
		hsl-004.html
		hsl-005.html
		hsl-006.html
		hsl-007.html
		hsl-008.html
		hsl-clamp-negative-saturation.html
		background-color-hsl-001.html
		background-color-hsl-002.html
		background-color-hsl-003.html
		background-color-hsl-004.html
		parsing/color-computed-hsl.html
		parsing/color-invalid-hsl.html
		parsing/color-valid-hsl.html
	</wpt>

	The first argument specifies the hue angle.

	In HSL (and HWB) the angle ''0deg'' represents sRGB primary red
	(as does ''360deg'', ''720deg'', etc.),
	and the rest of the hues are spread around the circle,
	so ''120deg'' represents sRGB primary green,
	''240deg'' represents sRGB primary blue, etc.

	The next two arguments are the saturation and lightness, respectively.
	For saturation, ''100%'' or ''100'' is a fully-saturated, bright color,
	and ''0%'' or ''0'' is a fully-unsaturated gray.
	For lightness, ''50%'' or ''50'' represents the "normal" color,
	while ''100%'' or ''100'' is white and ''0%''  or ''0'' is black.

	<!-- https://github.com/w3c/csswg-drafts/issues/9222 -->
	For historical reasons,
	if the saturation is less than ''0%''
	it is clamped to ''0%''
	at parsed-value time,
	before being converted to an sRGB color.

	<wpt>
		parsing/color-valid-hsl.html
	</wpt>

	The final argument specifies the alpha component of the color.
	It's interpreted identically to the fourth argument of the ''rgb()'' function.
	If omitted, it defaults to ''100%''.

	HSL colors resolve to sRGB.

	If the saturation of an HSL color is ''0%'' or ''0'',
	then the hue component is [=powerless=].

	<div class='example' id="ex-hsl-primary-red">
		For example, an ordinary red,
		the same color you would see from the keyword <span class="swatch" style="--color: red"></span>&nbsp;''red''
		or the hex notation <span class="swatch" style="--color: red"></span>&nbsp;''#f00'',
		is represented in HSL as <span class="swatch" style="--color: red"></span>&nbsp;''hsl(0deg 100% 50%)''.
	</div>

	An advantage of HSL over RGB is that it is more intuitive:
	people can guess at the colors they want,
	and then tweak.

	<div class='example' id="ex-hsl-tweak">
		For example, the following colors can all be generated off of the basic "green" hue,
		just by varying the other two arguments:

		<pre class="lang-css">
		hsl(120deg 100% 50%) <span style="color:black; background:hsl(120,100%,50%);">lime green</span>
		hsl(120deg 100% 25%) <span style="color:white; background:hsl(120,100%,25%);">dark green</span>
		hsl(120deg 100% 75%) <span style="color:black; background:hsl(120,100%,75%);">light green</span>
		hsl(120deg 75% 85%)  <span style="color:black; background:hsl(120,75%,85%);">pastel green</span>
		</pre>
	</div>

	<!-- unbounded hsl
	An advantage of HSL over LCH is that,
	regardless of manipulation,
	the result always lies inside the sRGB gamut. -->
	<p id="disadvantage-hsl">A disadvantage of HSL over OkLCh
	is that hue manipulation changes the visual lightness,
	and that hues are not evenly spaced apart.</p>

	It is thus easier in HSL to create sets of matching colors
	(by keeping the hue the same and varying the saturation and lightness),
	compared to manipulating the sRGB component values;
	however, because the lightness is simply the mean of the gamma-corrected
	red, green and blue components
	it does not correspond to the visual perception of lightness
	across hues.

	<div class="example" id="ex-hsl-sucks">
		For example, <span class="swatch" style="--color: blue"></span>&nbsp;''blue''
		is represented in HSL as
		<span class="swatch" style="--color: blue"></span>&nbsp;''hsl(240deg 100% 50%)''
		while <span class="swatch" style="--color: yellow"></span>&nbsp;''yellow''
		is <span class="swatch" style="--color: yellow"></span>&nbsp;''hsl(60deg 100% 50%)''.
		Both have an HSL Lightness of 50%,
		but clearly the yellow looks much lighter than the blue.

		In OkLCh, sRGB blue is
		<span class="swatch" style="--color: blue"></span>&nbsp;''oklch(0.452 0.313 264.1)''
		while
		sRGB yellow is
		<span class="swatch" style="--color: yellow"></span>&nbsp;''oklch(0.968 0.211 109.8)''.
		The OkLCh Lightnesses of 0.452 and 0.968 clearly reflect
		the visual lightnesses of the two colors.
	</div>

	The hue angle in HSL is not perceptually uniform;
	colors appear bunched up in some areas
	and widely spaced in others.

	<div class="example" id="ex-hsl-sucks-more">
		For example, the pair of hues
		<!--
			hsl(220 100% 50%) 42.114139000774955, 97.39536874737148, 290.5815091930946
			hsl(250 100% 50%) 30.84988530751331, 129.71314978865763, 302.1290808073227
		-->
		<!--
			hsl(50 100% 50%)  86.84897521929184, 86.24043356068755, 87.26505542654621
			hsl(80 100% 50%) 91.96771031614921, 98.8076382873608, 119.14730687158351
		-->
		<span class="swatch" style="--color: hsl(220 100% 50%)"></span>&nbsp;''hsl(220deg 100% 50%)''
		and
		<span class="swatch" style="--color: hsl(250 100% 50%)"></span>&nbsp;''hsl(250deg 100% 50%)''
		have an HSL hue difference of 250-220 = <strong>30</strong>deg and look fairly similar,
		while another pair of colors
		<span class="swatch" style="--color: hsl(50 100% 50%)"></span>&nbsp;''hsl(50deg 100% 50%)''
		and
		<span class="swatch" style="--color: hsl(80 100% 50%)"></span>&nbsp;''hsl(80deg 100% 50%)'',
		which <em>also</em> have a hue difference of 80-50 = <strong>30</strong>deg, look very different.

		In OkLCh, the same pair of colors
		<span class="swatch" style="--color: hsl(220 100% 50%)"></span>&nbsp;''oklch(0.533 0.26 262.6)''
		and
		<span class="swatch" style="--color: hsl(250 100% 50%)"></span>&nbsp;''oklch(0.462 0.306 268.9)''
		have a hue difference of 268.9 - 262.6 = <strong>6.3</strong>deg
		while the second pair
		<span class="swatch" style="--color: hsl(50 100% 50%)"></span>&nbsp;''oklch(0.882 0.181 94.24)''
		and
		<span class="swatch" style="--color: hsl(80 100% 50%)"></span>&nbsp;''oklch(0.91 0.245 129.9)''
		have a hue difference of 129.9 - 94.24 = <strong>35.66</strong>deg,
		correctly reflecting the visual separation of hues.

	</div>

	For historical reasons,
	''hsl()'' and ''hsla()'' also support a <a>legacy color syntax</a>.

	<wpt>
		hsla-001.html
		hsla-002.html
		hsla-003.html
		hsla-004.html
		hsla-005.html
		hsla-006.html
		hsla-007.html
		hsla-008.html
		hsla-clamp-negative-saturation.html
		parsing/color-valid.html
	</wpt>


<h3 id='hsl-to-rgb'>
Converting HSL Colors to sRGB</h3>

	Converting an HSL color to sRGB is straightforward mathematically.
	Here's a sample implementation of the conversion algorithm in JavaScript.
	It returns an array of three numbers
	representing the red, green, and blue components of the colors,
	which for colors in the sRGB gamut will be in the range [0, 1].

	This code assumes that <em>parse-time</em> clamping
	of negative saturation has already been applied.

	<pre class="include-code lang-javascript">
		path: hslToRgb.js
		highlight: js
	</pre>

<h3 id='rgb-to-hsl'>
Converting sRGB Colors to HSL</h3>

	Conversion in the reverse direction proceeds similarly.

	Special care is taken to deal with
	intermediate negative values of saturation,
	which can be produced by colors far outside the sRGB gamut.

	<pre class="include-code lang-javascript">
		path: better-rgbToHsl.js
		highlight: js
	</pre>

<h3 id='hsl-examples'>
Examples of HSL Colors</h3>

<em>This section is not normative.</em>
<wpt title="This section is not normative, it does not need tests."></wpt>

	The tables below illustrate a wide range of possible HSL colors.
	Each table represents one hue,
	selected at 30° intervals,
	to illustrate the common "core" hues:
	red,
	yellow,
	green,
	cyan,
	blue,
	magenta,
	and the six intermediary colors between these.

	In each table, the X axis represents the saturation
	while the Y axis represents the lightness.

	<!--
	  see workings/hsl-tables-for-color-3-errata/ to regenerate the table
	  the contents of hslstyle.css are inline in this document
	-->

	<div id="hsltable" class="color-table">
		<table>
			<thead>
				<tr>
					<th colspan="7">0° Reds</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(255, 204, 204);"></td><td style="background-color: rgb(250, 209, 209);"></td><td style="background-color: rgb(245, 214, 214);"></td><td style="background-color: rgb(240, 219, 219);"></td><td style="background-color: rgb(235, 224, 224);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(255, 153, 153);"></td><td style="background-color: rgb(245, 163, 163);"></td><td style="background-color: rgb(235, 173, 173);"></td><td style="background-color: rgb(224, 184, 184);"></td><td style="background-color: rgb(214, 194, 194);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(255, 102, 102);"></td><td style="background-color: rgb(240, 117, 117);"></td><td style="background-color: rgb(224, 133, 133);"></td><td style="background-color: rgb(209, 148, 148);"></td><td style="background-color: rgb(194, 163, 163);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(255, 51, 51);"></td><td style="background-color: rgb(235, 71, 71);"></td><td style="background-color: rgb(214, 92, 92);"></td><td style="background-color: rgb(194, 112, 112);"></td><td style="background-color: rgb(173, 133, 133);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(255, 0, 0);"></td><td style="background-color: rgb(230, 26, 26);"></td><td style="background-color: rgb(204, 51, 51);"></td><td style="background-color: rgb(179, 77, 77);"></td><td style="background-color: rgb(153, 102, 102);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(204, 0, 0);"></td><td style="background-color: rgb(184, 20, 20);"></td><td style="background-color: rgb(163, 41, 41);"></td><td style="background-color: rgb(143, 61, 61);"></td><td style="background-color: rgb(122, 82, 82);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(153, 0, 0);"></td><td style="background-color: rgb(138, 15, 15);"></td><td style="background-color: rgb(122, 31, 31);"></td><td style="background-color: rgb(107, 46, 46);"></td><td style="background-color: rgb(92, 61, 61);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(102, 0, 0);"></td><td style="background-color: rgb(92, 10, 10);"></td><td style="background-color: rgb(82, 20, 20);"></td><td style="background-color: rgb(71, 31, 31);"></td><td style="background-color: rgb(61, 41, 41);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(51, 0, 0);"></td><td style="background-color: rgb(46, 5, 5);"></td><td style="background-color: rgb(41, 10, 10);"></td><td style="background-color: rgb(36, 15, 15);"></td><td style="background-color: rgb(31, 20, 20);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">30° Reds-Yellows (=Oranges)</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(255, 230, 204);"></td><td style="background-color: rgb(250, 230, 209);"></td><td style="background-color: rgb(245, 230, 214);"></td><td style="background-color: rgb(240, 230, 219);"></td><td style="background-color: rgb(235, 230, 224);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(255, 204, 153);"></td><td style="background-color: rgb(245, 204, 163);"></td><td style="background-color: rgb(235, 204, 173);"></td><td style="background-color: rgb(224, 204, 184);"></td><td style="background-color: rgb(214, 204, 194);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(255, 179, 102);"></td><td style="background-color: rgb(240, 179, 117);"></td><td style="background-color: rgb(224, 179, 133);"></td><td style="background-color: rgb(209, 179, 148);"></td><td style="background-color: rgb(194, 179, 163);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(255, 153, 51);"></td><td style="background-color: rgb(235, 153, 71);"></td><td style="background-color: rgb(214, 153, 92);"></td><td style="background-color: rgb(194, 153, 112);"></td><td style="background-color: rgb(173, 153, 133);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(255, 128, 0);"></td><td style="background-color: rgb(230, 128, 26);"></td><td style="background-color: rgb(204, 128, 51);"></td><td style="background-color: rgb(179, 128, 77);"></td><td style="background-color: rgb(153, 128, 102);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(204, 102, 0);"></td><td style="background-color: rgb(184, 102, 20);"></td><td style="background-color: rgb(163, 102, 41);"></td><td style="background-color: rgb(143, 102, 61);"></td><td style="background-color: rgb(122, 102, 82);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(153, 77, 0);"></td><td style="background-color: rgb(138, 77, 15);"></td><td style="background-color: rgb(122, 77, 31);"></td><td style="background-color: rgb(107, 77, 46);"></td><td style="background-color: rgb(92, 77, 61);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(102, 51, 0);"></td><td style="background-color: rgb(92, 51, 10);"></td><td style="background-color: rgb(82, 51, 20);"></td><td style="background-color: rgb(71, 51, 31);"></td><td style="background-color: rgb(61, 51, 41);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(51, 26, 0);"></td><td style="background-color: rgb(46, 26, 5);"></td><td style="background-color: rgb(41, 26, 10);"></td><td style="background-color: rgb(36, 26, 15);"></td><td style="background-color: rgb(31, 26, 20);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">60° Yellows</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(255, 255, 204);"></td><td style="background-color: rgb(250, 250, 209);"></td><td style="background-color: rgb(245, 245, 214);"></td><td style="background-color: rgb(240, 240, 219);"></td><td style="background-color: rgb(235, 235, 224);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(255, 255, 153);"></td><td style="background-color: rgb(245, 245, 163);"></td><td style="background-color: rgb(235, 235, 173);"></td><td style="background-color: rgb(224, 224, 184);"></td><td style="background-color: rgb(214, 214, 194);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(255, 255, 102);"></td><td style="background-color: rgb(240, 240, 117);"></td><td style="background-color: rgb(224, 224, 133);"></td><td style="background-color: rgb(209, 209, 148);"></td><td style="background-color: rgb(194, 194, 163);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(255, 255, 51);"></td><td style="background-color: rgb(235, 235, 71);"></td><td style="background-color: rgb(214, 214, 92);"></td><td style="background-color: rgb(194, 194, 112);"></td><td style="background-color: rgb(173, 173, 133);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(255, 255, 0);"></td><td style="background-color: rgb(230, 230, 26);"></td><td style="background-color: rgb(204, 204, 51);"></td><td style="background-color: rgb(179, 179, 77);"></td><td style="background-color: rgb(153, 153, 102);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(204, 204, 0);"></td><td style="background-color: rgb(184, 184, 20);"></td><td style="background-color: rgb(163, 163, 41);"></td><td style="background-color: rgb(143, 143, 61);"></td><td style="background-color: rgb(122, 122, 82);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(153, 153, 0);"></td><td style="background-color: rgb(138, 138, 15);"></td><td style="background-color: rgb(122, 122, 31);"></td><td style="background-color: rgb(107, 107, 46);"></td><td style="background-color: rgb(92, 92, 61);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(102, 102, 0);"></td><td style="background-color: rgb(92, 92, 10);"></td><td style="background-color: rgb(82, 82, 20);"></td><td style="background-color: rgb(71, 71, 31);"></td><td style="background-color: rgb(61, 61, 41);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(51, 51, 0);"></td><td style="background-color: rgb(46, 46, 5);"></td><td style="background-color: rgb(41, 41, 10);"></td><td style="background-color: rgb(36, 36, 15);"></td><td style="background-color: rgb(31, 31, 20);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">90° Yellow-Greens</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(230, 255, 204);"></td><td style="background-color: rgb(230, 250, 209);"></td><td style="background-color: rgb(230, 245, 214);"></td><td style="background-color: rgb(230, 240, 219);"></td><td style="background-color: rgb(230, 235, 224);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(204, 255, 153);"></td><td style="background-color: rgb(204, 245, 163);"></td><td style="background-color: rgb(204, 235, 173);"></td><td style="background-color: rgb(204, 224, 184);"></td><td style="background-color: rgb(204, 214, 194);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(179, 255, 102);"></td><td style="background-color: rgb(179, 240, 117);"></td><td style="background-color: rgb(179, 224, 133);"></td><td style="background-color: rgb(179, 209, 148);"></td><td style="background-color: rgb(179, 194, 163);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(153, 255, 51);"></td><td style="background-color: rgb(153, 235, 71);"></td><td style="background-color: rgb(153, 214, 92);"></td><td style="background-color: rgb(153, 194, 112);"></td><td style="background-color: rgb(153, 173, 133);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(128, 255, 0);"></td><td style="background-color: rgb(128, 230, 26);"></td><td style="background-color: rgb(128, 204, 51);"></td><td style="background-color: rgb(128, 179, 77);"></td><td style="background-color: rgb(128, 153, 102);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(102, 204, 0);"></td><td style="background-color: rgb(102, 184, 20);"></td><td style="background-color: rgb(102, 163, 41);"></td><td style="background-color: rgb(102, 143, 61);"></td><td style="background-color: rgb(102, 122, 82);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(77, 153, 0);"></td><td style="background-color: rgb(77, 138, 15);"></td><td style="background-color: rgb(77, 122, 31);"></td><td style="background-color: rgb(77, 107, 46);"></td><td style="background-color: rgb(77, 92, 61);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(51, 102, 0);"></td><td style="background-color: rgb(51, 92, 10);"></td><td style="background-color: rgb(51, 82, 20);"></td><td style="background-color: rgb(51, 71, 31);"></td><td style="background-color: rgb(51, 61, 41);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(26, 51, 0);"></td><td style="background-color: rgb(26, 46, 5);"></td><td style="background-color: rgb(26, 41, 10);"></td><td style="background-color: rgb(26, 36, 15);"></td><td style="background-color: rgb(26, 31, 20);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">120° Greens</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(204, 255, 204);"></td><td style="background-color: rgb(209, 250, 209);"></td><td style="background-color: rgb(214, 245, 214);"></td><td style="background-color: rgb(219, 240, 219);"></td><td style="background-color: rgb(224, 235, 224);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(153, 255, 153);"></td><td style="background-color: rgb(163, 245, 163);"></td><td style="background-color: rgb(173, 235, 173);"></td><td style="background-color: rgb(184, 224, 184);"></td><td style="background-color: rgb(194, 214, 194);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(102, 255, 102);"></td><td style="background-color: rgb(117, 240, 117);"></td><td style="background-color: rgb(133, 224, 133);"></td><td style="background-color: rgb(148, 209, 148);"></td><td style="background-color: rgb(163, 194, 163);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(51, 255, 51);"></td><td style="background-color: rgb(71, 235, 71);"></td><td style="background-color: rgb(92, 214, 92);"></td><td style="background-color: rgb(112, 194, 112);"></td><td style="background-color: rgb(133, 173, 133);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(0, 255, 0);"></td><td style="background-color: rgb(26, 230, 26);"></td><td style="background-color: rgb(51, 204, 51);"></td><td style="background-color: rgb(77, 179, 77);"></td><td style="background-color: rgb(102, 153, 102);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(0, 204, 0);"></td><td style="background-color: rgb(20, 184, 20);"></td><td style="background-color: rgb(41, 163, 41);"></td><td style="background-color: rgb(61, 143, 61);"></td><td style="background-color: rgb(82, 122, 82);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(0, 153, 0);"></td><td style="background-color: rgb(15, 138, 15);"></td><td style="background-color: rgb(31, 122, 31);"></td><td style="background-color: rgb(46, 107, 46);"></td><td style="background-color: rgb(61, 92, 61);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(0, 102, 0);"></td><td style="background-color: rgb(10, 92, 10);"></td><td style="background-color: rgb(20, 82, 20);"></td><td style="background-color: rgb(31, 71, 31);"></td><td style="background-color: rgb(41, 61, 41);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(0, 51, 0);"></td><td style="background-color: rgb(5, 46, 5);"></td><td style="background-color: rgb(10, 41, 10);"></td><td style="background-color: rgb(15, 36, 15);"></td><td style="background-color: rgb(20, 31, 20);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">150° Green-Cyans</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(204, 255, 230);"></td><td style="background-color: rgb(209, 250, 230);"></td><td style="background-color: rgb(214, 245, 230);"></td><td style="background-color: rgb(219, 240, 230);"></td><td style="background-color: rgb(224, 235, 230);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(153, 255, 204);"></td><td style="background-color: rgb(163, 245, 204);"></td><td style="background-color: rgb(173, 235, 204);"></td><td style="background-color: rgb(184, 224, 204);"></td><td style="background-color: rgb(194, 214, 204);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(102, 255, 179);"></td><td style="background-color: rgb(117, 240, 179);"></td><td style="background-color: rgb(133, 224, 179);"></td><td style="background-color: rgb(148, 209, 179);"></td><td style="background-color: rgb(163, 194, 179);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(51, 255, 153);"></td><td style="background-color: rgb(71, 235, 153);"></td><td style="background-color: rgb(92, 214, 153);"></td><td style="background-color: rgb(112, 194, 153);"></td><td style="background-color: rgb(133, 173, 153);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(0, 255, 128);"></td><td style="background-color: rgb(26, 230, 128);"></td><td style="background-color: rgb(51, 204, 128);"></td><td style="background-color: rgb(77, 179, 128);"></td><td style="background-color: rgb(102, 153, 128);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(0, 204, 102);"></td><td style="background-color: rgb(20, 184, 102);"></td><td style="background-color: rgb(41, 163, 102);"></td><td style="background-color: rgb(61, 143, 102);"></td><td style="background-color: rgb(82, 122, 102);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(0, 153, 77);"></td><td style="background-color: rgb(15, 138, 77);"></td><td style="background-color: rgb(31, 122, 77);"></td><td style="background-color: rgb(46, 107, 77);"></td><td style="background-color: rgb(61, 92, 77);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(0, 102, 51);"></td><td style="background-color: rgb(10, 92, 51);"></td><td style="background-color: rgb(20, 82, 51);"></td><td style="background-color: rgb(31, 71, 51);"></td><td style="background-color: rgb(41, 61, 51);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(0, 51, 26);"></td><td style="background-color: rgb(5, 46, 26);"></td><td style="background-color: rgb(10, 41, 26);"></td><td style="background-color: rgb(15, 36, 26);"></td><td style="background-color: rgb(20, 31, 26);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">180° Cyans</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(204, 255, 255);"></td><td style="background-color: rgb(209, 250, 250);"></td><td style="background-color: rgb(214, 245, 245);"></td><td style="background-color: rgb(219, 240, 240);"></td><td style="background-color: rgb(224, 235, 235);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(153, 255, 255);"></td><td style="background-color: rgb(163, 245, 245);"></td><td style="background-color: rgb(173, 235, 235);"></td><td style="background-color: rgb(184, 224, 224);"></td><td style="background-color: rgb(194, 214, 214);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(102, 255, 255);"></td><td style="background-color: rgb(117, 240, 240);"></td><td style="background-color: rgb(133, 224, 224);"></td><td style="background-color: rgb(148, 209, 209);"></td><td style="background-color: rgb(163, 194, 194);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(51, 255, 255);"></td><td style="background-color: rgb(71, 235, 235);"></td><td style="background-color: rgb(92, 214, 214);"></td><td style="background-color: rgb(112, 194, 194);"></td><td style="background-color: rgb(133, 173, 173);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(0, 255, 255);"></td><td style="background-color: rgb(26, 230, 230);"></td><td style="background-color: rgb(51, 204, 204);"></td><td style="background-color: rgb(77, 179, 179);"></td><td style="background-color: rgb(102, 153, 153);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(0, 204, 204);"></td><td style="background-color: rgb(20, 184, 184);"></td><td style="background-color: rgb(41, 163, 163);"></td><td style="background-color: rgb(61, 143, 143);"></td><td style="background-color: rgb(82, 122, 122);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(0, 153, 153);"></td><td style="background-color: rgb(15, 138, 138);"></td><td style="background-color: rgb(31, 122, 122);"></td><td style="background-color: rgb(46, 107, 107);"></td><td style="background-color: rgb(61, 92, 92);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(0, 102, 102);"></td><td style="background-color: rgb(10, 92, 92);"></td><td style="background-color: rgb(20, 82, 82);"></td><td style="background-color: rgb(31, 71, 71);"></td><td style="background-color: rgb(41, 61, 61);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(0, 51, 51);"></td><td style="background-color: rgb(5, 46, 46);"></td><td style="background-color: rgb(10, 41, 41);"></td><td style="background-color: rgb(15, 36, 36);"></td><td style="background-color: rgb(20, 31, 31);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">210° Cyan-Blues</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(204, 230, 255);"></td><td style="background-color: rgb(209, 230, 250);"></td><td style="background-color: rgb(214, 230, 245);"></td><td style="background-color: rgb(219, 230, 240);"></td><td style="background-color: rgb(224, 230, 235);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(153, 204, 255);"></td><td style="background-color: rgb(163, 204, 245);"></td><td style="background-color: rgb(173, 204, 235);"></td><td style="background-color: rgb(184, 204, 224);"></td><td style="background-color: rgb(194, 204, 214);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(102, 179, 255);"></td><td style="background-color: rgb(117, 179, 240);"></td><td style="background-color: rgb(133, 179, 224);"></td><td style="background-color: rgb(148, 179, 209);"></td><td style="background-color: rgb(163, 179, 194);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(51, 153, 255);"></td><td style="background-color: rgb(71, 153, 235);"></td><td style="background-color: rgb(92, 153, 214);"></td><td style="background-color: rgb(112, 153, 194);"></td><td style="background-color: rgb(133, 153, 173);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(0, 128, 255);"></td><td style="background-color: rgb(26, 128, 230);"></td><td style="background-color: rgb(51, 128, 204);"></td><td style="background-color: rgb(77, 128, 179);"></td><td style="background-color: rgb(102, 128, 153);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(0, 102, 204);"></td><td style="background-color: rgb(20, 102, 184);"></td><td style="background-color: rgb(41, 102, 163);"></td><td style="background-color: rgb(61, 102, 143);"></td><td style="background-color: rgb(82, 102, 122);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(0, 77, 153);"></td><td style="background-color: rgb(15, 77, 138);"></td><td style="background-color: rgb(31, 77, 122);"></td><td style="background-color: rgb(46, 77, 107);"></td><td style="background-color: rgb(61, 77, 92);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(0, 51, 102);"></td><td style="background-color: rgb(10, 51, 92);"></td><td style="background-color: rgb(20, 51, 82);"></td><td style="background-color: rgb(31, 51, 71);"></td><td style="background-color: rgb(41, 51, 61);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(0, 26, 51);"></td><td style="background-color: rgb(5, 26, 46);"></td><td style="background-color: rgb(10, 26, 41);"></td><td style="background-color: rgb(15, 26, 36);"></td><td style="background-color: rgb(20, 26, 31);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">240° blues</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(204, 204, 255);"></td><td style="background-color: rgb(209, 209, 250);"></td><td style="background-color: rgb(214, 214, 245);"></td><td style="background-color: rgb(219, 219, 240);"></td><td style="background-color: rgb(224, 224, 235);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(153, 153, 255);"></td><td style="background-color: rgb(163, 163, 245);"></td><td style="background-color: rgb(173, 173, 235);"></td><td style="background-color: rgb(184, 184, 224);"></td><td style="background-color: rgb(194, 194, 214);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(102, 102, 255);"></td><td style="background-color: rgb(117, 117, 240);"></td><td style="background-color: rgb(133, 133, 224);"></td><td style="background-color: rgb(148, 148, 209);"></td><td style="background-color: rgb(163, 163, 194);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(51, 51, 255);"></td><td style="background-color: rgb(71, 71, 235);"></td><td style="background-color: rgb(92, 92, 214);"></td><td style="background-color: rgb(112, 112, 194);"></td><td style="background-color: rgb(133, 133, 173);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(0, 0, 255);"></td><td style="background-color: rgb(26, 26, 230);"></td><td style="background-color: rgb(51, 51, 204);"></td><td style="background-color: rgb(77, 77, 179);"></td><td style="background-color: rgb(102, 102, 153);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(0, 0, 204);"></td><td style="background-color: rgb(20, 20, 184);"></td><td style="background-color: rgb(41, 41, 163);"></td><td style="background-color: rgb(61, 61, 143);"></td><td style="background-color: rgb(82, 82, 122);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(0, 0, 153);"></td><td style="background-color: rgb(15, 15, 138);"></td><td style="background-color: rgb(31, 31, 122);"></td><td style="background-color: rgb(46, 46, 107);"></td><td style="background-color: rgb(61, 61, 92);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(0, 0, 102);"></td><td style="background-color: rgb(10, 10, 92);"></td><td style="background-color: rgb(20, 20, 82);"></td><td style="background-color: rgb(31, 31, 71);"></td><td style="background-color: rgb(41, 41, 61);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(0, 0, 51);"></td><td style="background-color: rgb(5, 5, 46);"></td><td style="background-color: rgb(10, 10, 41);"></td><td style="background-color: rgb(15, 15, 36);"></td><td style="background-color: rgb(20, 20, 31);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">270° Blue-Magentas</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(230, 204, 255);"></td><td style="background-color: rgb(230, 209, 250);"></td><td style="background-color: rgb(230, 214, 245);"></td><td style="background-color: rgb(230, 219, 240);"></td><td style="background-color: rgb(230, 224, 235);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(204, 153, 255);"></td><td style="background-color: rgb(204, 163, 245);"></td><td style="background-color: rgb(204, 173, 235);"></td><td style="background-color: rgb(204, 184, 224);"></td><td style="background-color: rgb(204, 194, 214);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(179, 102, 255);"></td><td style="background-color: rgb(179, 117, 240);"></td><td style="background-color: rgb(179, 133, 224);"></td><td style="background-color: rgb(179, 148, 209);"></td><td style="background-color: rgb(179, 163, 194);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(153, 51, 255);"></td><td style="background-color: rgb(153, 71, 235);"></td><td style="background-color: rgb(153, 92, 214);"></td><td style="background-color: rgb(153, 112, 194);"></td><td style="background-color: rgb(153, 133, 173);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(128, 0, 255);"></td><td style="background-color: rgb(128, 26, 230);"></td><td style="background-color: rgb(128, 51, 204);"></td><td style="background-color: rgb(128, 77, 179);"></td><td style="background-color: rgb(128, 102, 153);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(102, 0, 204);"></td><td style="background-color: rgb(102, 20, 184);"></td><td style="background-color: rgb(102, 41, 163);"></td><td style="background-color: rgb(102, 61, 143);"></td><td style="background-color: rgb(102, 82, 122);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(77, 0, 153);"></td><td style="background-color: rgb(77, 15, 138);"></td><td style="background-color: rgb(77, 31, 122);"></td><td style="background-color: rgb(77, 46, 107);"></td><td style="background-color: rgb(77, 61, 92);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(51, 0, 102);"></td><td style="background-color: rgb(51, 10, 92);"></td><td style="background-color: rgb(51, 20, 82);"></td><td style="background-color: rgb(51, 31, 71);"></td><td style="background-color: rgb(51, 41, 61);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(26, 0, 51);"></td><td style="background-color: rgb(26, 5, 46);"></td><td style="background-color: rgb(26, 10, 41);"></td><td style="background-color: rgb(26, 15, 36);"></td><td style="background-color: rgb(26, 20, 31);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">300° Magentas</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(255, 204, 255);"></td><td style="background-color: rgb(250, 209, 250);"></td><td style="background-color: rgb(245, 214, 245);"></td><td style="background-color: rgb(240, 219, 240);"></td><td style="background-color: rgb(235, 224, 235);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(255, 153, 255);"></td><td style="background-color: rgb(245, 163, 245);"></td><td style="background-color: rgb(235, 173, 235);"></td><td style="background-color: rgb(224, 184, 224);"></td><td style="background-color: rgb(214, 194, 214);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(255, 102, 255);"></td><td style="background-color: rgb(240, 117, 240);"></td><td style="background-color: rgb(224, 133, 224);"></td><td style="background-color: rgb(209, 148, 209);"></td><td style="background-color: rgb(194, 163, 194);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(255, 51, 255);"></td><td style="background-color: rgb(235, 71, 235);"></td><td style="background-color: rgb(214, 92, 214);"></td><td style="background-color: rgb(194, 112, 194);"></td><td style="background-color: rgb(173, 133, 173);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(255, 0, 255);"></td><td style="background-color: rgb(230, 26, 230);"></td><td style="background-color: rgb(204, 51, 204);"></td><td style="background-color: rgb(179, 77, 179);"></td><td style="background-color: rgb(153, 102, 153);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(204, 0, 204);"></td><td style="background-color: rgb(184, 20, 184);"></td><td style="background-color: rgb(163, 41, 163);"></td><td style="background-color: rgb(143, 61, 143);"></td><td style="background-color: rgb(122, 82, 122);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(153, 0, 153);"></td><td style="background-color: rgb(138, 15, 138);"></td><td style="background-color: rgb(122, 31, 122);"></td><td style="background-color: rgb(107, 46, 107);"></td><td style="background-color: rgb(92, 61, 92);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(102, 0, 102);"></td><td style="background-color: rgb(92, 10, 92);"></td><td style="background-color: rgb(82, 20, 82);"></td><td style="background-color: rgb(71, 31, 71);"></td><td style="background-color: rgb(61, 41, 61);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(51, 0, 51);"></td><td style="background-color: rgb(46, 5, 46);"></td><td style="background-color: rgb(41, 10, 41);"></td><td style="background-color: rgb(36, 15, 36);"></td><td style="background-color: rgb(31, 20, 31);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
		<table>
			<thead>
				<tr>
					<th colspan="7">330° Magenta-Reds</th>
				</tr>
				<tr>
					<th></th>
				<th>100%</th><th>80%</th><th>60%</th><th>40%</th><th>20%</th><th>0%</th></tr>
			</thead>
			<tr><th>100%</th><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td><td style="background-color: rgb(255, 255, 255);"></td>
			<tr><th>90%</th><td style="background-color: rgb(255, 204, 230);"></td><td style="background-color: rgb(250, 209, 230);"></td><td style="background-color: rgb(245, 214, 230);"></td><td style="background-color: rgb(240, 219, 230);"></td><td style="background-color: rgb(235, 224, 230);"></td><td style="background-color: rgb(230, 230, 230);"></td>
			<tr><th>80%</th><td style="background-color: rgb(255, 153, 204);"></td><td style="background-color: rgb(245, 163, 204);"></td><td style="background-color: rgb(235, 173, 204);"></td><td style="background-color: rgb(224, 184, 204);"></td><td style="background-color: rgb(214, 194, 204);"></td><td style="background-color: rgb(204, 204, 204);"></td>
			<tr><th>70%</th><td style="background-color: rgb(255, 102, 179);"></td><td style="background-color: rgb(240, 117, 179);"></td><td style="background-color: rgb(224, 133, 179);"></td><td style="background-color: rgb(209, 148, 179);"></td><td style="background-color: rgb(194, 163, 179);"></td><td style="background-color: rgb(179, 179, 179);"></td>
			<tr><th>60%</th><td style="background-color: rgb(255, 51, 153);"></td><td style="background-color: rgb(235, 71, 153);"></td><td style="background-color: rgb(214, 92, 153);"></td><td style="background-color: rgb(194, 112, 153);"></td><td style="background-color: rgb(173, 133, 153);"></td><td style="background-color: rgb(153, 153, 153);"></td>
			<tr><th>50%</th><td style="background-color: rgb(255, 0, 128);"></td><td style="background-color: rgb(230, 26, 128);"></td><td style="background-color: rgb(204, 51, 128);"></td><td style="background-color: rgb(179, 77, 128);"></td><td style="background-color: rgb(153, 102, 128);"></td><td style="background-color: rgb(128, 128, 128);"></td>
			<tr><th>40%</th><td style="background-color: rgb(204, 0, 102);"></td><td style="background-color: rgb(184, 20, 102);"></td><td style="background-color: rgb(163, 41, 102);"></td><td style="background-color: rgb(143, 61, 102);"></td><td style="background-color: rgb(122, 82, 102);"></td><td style="background-color: rgb(102, 102, 102);"></td>
			<tr><th>30%</th><td style="background-color: rgb(153, 0, 77);"></td><td style="background-color: rgb(138, 15, 77);"></td><td style="background-color: rgb(122, 31, 77);"></td><td style="background-color: rgb(107, 46, 77);"></td><td style="background-color: rgb(92, 61, 77);"></td><td style="background-color: rgb(77, 77, 77);"></td>
			<tr><th>20%</th><td style="background-color: rgb(102, 0, 51);"></td><td style="background-color: rgb(92, 10, 51);"></td><td style="background-color: rgb(82, 20, 51);"></td><td style="background-color: rgb(71, 31, 51);"></td><td style="background-color: rgb(61, 41, 51);"></td><td style="background-color: rgb(51, 51, 51);"></td>
			<tr><th>10%</th><td style="background-color: rgb(51, 0, 26);"></td><td style="background-color: rgb(46, 5, 26);"></td><td style="background-color: rgb(41, 10, 26);"></td><td style="background-color: rgb(36, 15, 26);"></td><td style="background-color: rgb(31, 20, 26);"></td><td style="background-color: rgb(26, 26, 26);"></td>
			<tr><th>0%</th><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td><td style="background-color: rgb(0, 0, 0);"></td></tr>
		</table>
	</div>


<!--
██     ██ ██      ██ ████████
██     ██ ██  ██  ██ ██     ██
██     ██ ██  ██  ██ ██     ██
█████████ ██  ██  ██ ████████
██     ██ ██  ██  ██ ██     ██
██     ██ ██  ██  ██ ██     ██
██     ██  ███  ███  ████████
-->


<h2 id='the-hwb-notation'>
HWB Colors: ''hwb()'' function</h2>

	<dfn value export for="hwb()">HWB</dfn> (short for Hue-Whiteness-Blackness)
	[[!HWB]]
	is another method of specifying sRGB colors,
	similar to ''HSL''', but often even easier for humans to work with.
	It describes colors with a starting hue,
	then a degree of whiteness and blackness to mix into that base hue.

	Many color-pickers are based on the HWB color system,
	due to its intuitiveness.

	HWB colors resolve to sRGB.

	<figure id="fig-chrome-hwb-picker">
		<img src="images/color-picker.png" width="545" height="309" alt="">
		<figcaption>
			This is a screenshot of Chrome's color picker,
			shown when a user activates an <code class='lang-markup'>&lt;input type="color"></code>.
			The outer wheel is used to select the hue,
			then the relative amounts of white and black are selected by clicking on the inner triangle.
		</figcaption>
	</figure>

	The syntax of the ''hwb()'' function is:

	<pre class='prod'>
		<dfn>hwb()</dfn> = hwb(
			[<<hue>> | none]
			[<<percentage>> | <<number>> | none]
			[<<percentage>> | <<number>> | none]
			[ / [<<alpha-value>> | none] ]? )
	</pre>

	<table id="prr-hwb">
		<tr>
			<th>Percentages</th>
			<td>Allowed for W and B</td>
		</tr>
		<tr>
			<th>Percent reference range&nbsp;</th>
			<td>
				for W and B: 0% = 0.0, 100% = 100.0
			</td>
		</tr>
		<tr>
			<th>Powerless hue ε</th>
			<td>W + B >= 99.999</td>
		</tr>
	</table>

	The first argument specifies the hue,
	and is defined identically to ''hsl()'';
	this means it <a href="#disadvantage-hsl">suffers the same disadvantages</a>
	such as hue uniformity.

	The second argument specifies the amount of white to mix in,
	as a percentage from ''0%'' (no whiteness) to ''100%'' (full whiteness).
	Similarly, the third argument specifies the amount of black to mix in,
	also from ''0%'' (no blackness) to ''100%'' (full blackness).

	<div class="example" id="ex-hwb-simple">
		For example, <span class="swatch" style="--color:hwb(150 20% 10%)"></span>&nbsp;hwb(150 20% 10%)
		is the same color as
		<span class="swatch" style="--color:hwb(150 20% 10%)"></span>&nbsp;hsl(150 77.78% 55%)
		and
		<span class="swatch" style="--color:hwb(150 20% 10%)"></span>&nbsp;rgb(20% 90% 55%).
	</div>

	Note: ''hwb()'' does not account for the  Abney effect [[Abney]]
	which is the perceived hue shift that occurs
	when white light is added to a monochromatic light source.

	<!-- unbounded hwb
	Values outside of these ranges
	are not invalid,
	but are clamped to the ranges defined here at parsed-value time.
	If the sum of these two arguments is greater than 100%,
	then at parsed-value time they are further normalized to add up to 100%,
	with the same relative ratio. -->

	Values outside of these ranges
	are not invalid;
	hue angles outside the range [0,360) will be normalized to that range
	and values of white and black which sum to 100% or greater will
	produce achromatic colors as described below.

	<!-- handling of negative white or black is unspecified
		and the results with sample code are suprising.
		No round-tripping of oog colors, unlike HSL -->

	The resulting color can be thought of conceptually as a mixture of paint in the chosen hue,
	white paint, and black paint,
	with the relative amounts of each determined by the percentages.

	<p id="hwb-normalization">If the sum white+black is greater than or equal to ''100%'',
	it defines an achromatic color,
	i.e. a shade of gray;
	when converted to sRGB the R, G and B values are identical
	and have the value white / (white + black).</p>

	<div class="example" id="ex-hwb-achromatic">
		For example, in the color
		<span class="swatch" style="--color:rgb(33.33% 33.33% 33.33%)"></span>&nbsp;hwb(45 40% 80%)
		white and black adds to 120, so this is an achromatic color
		whose R, G and B components are 40 / 40 + 80 = 0.33
		<span class="swatch" style="--color:rgb(33.33% 33.33% 33.33%)"></span>&nbsp;rgb(33.33% 33.33% 33.33%).
	</div>

	Achromatic HWB colors no longer contain any hint of the chosen hue.
	In this case, the hue component is [=powerless=].

	The fourth argument specifies the alpha component of the color.
	It's interpreted identically to the fourth argument of the ''rgb()'' function.
	If omitted, it defaults to ''100%''.

	There is no Web compatibility issue
	with ''hwb'', which is new in this level of the specification, and so
	''hwb()'' does <em>not</em> support a <a>legacy color syntax</a>
	that separates all of its arguments with commas.
	Using commas inside ''hwb()'' is an error.

	<wpt>
		hwb-001.html
		hwb-002.html
		hwb-003.html
		hwb-004.html
		hwb-005.html
		parsing/color-valid.html
		parsing/color-computed-hwb.html
		parsing/color-invalid-hwb.html
		parsing/color-valid-hwb.html
	</wpt>

<h3 id='hwb-to-rgb'>
Converting HWB Colors to sRGB</h3>

	Converting an HWB color to sRGB is straightforward,
	and related to how one converts HSL to RGB.
	The following Javascript implementation of the algorithm
	first normalizes the white and black components,
	so their sum is no larger than 100%.

	<pre class="include-code lang-javascript">
		path: hwbToRgb.js
		highlight: js
	</pre>

<h3 id="rgb-to-hwb">
Converting sRGB Colors to HWB</h3>

	Conversion in the reverse direction proceeds similarly.

	<pre class="include-code lang-javascript">
		path: rgbToHwb.js
		highlight: js
	</pre>

<h3 id='hwb-examples'>
Examples of HWB Colors</h3>

<em>This section is not normative.</em>
<wpt title="This section is not normative, it does not need tests."></wpt>

	<div class='color-table'>
		<table>
			<tr>
				<th><th colspan="6">0° Reds
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#ff0000"><td style="background-color:#cc0000"><td style="background-color:#990000"><td style="background-color:#660000"><td style="background-color:#330000"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#ff3333"><td style="background-color:#cc3333"><td style="background-color:#993333"><td style="background-color:#663333"><td style="background-color:#333333"><td style="background-color:#2a2b2b">
			<tr>
				<th>40%<td style="background-color:#ff6666"><td style="background-color:#cc6666"><td style="background-color:#996666"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#ff9999"><td style="background-color:#cc9999"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ffcccc"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d4d5d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">30° Red-Yellows (Oranges)
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#ff8000"><td style="background-color:#cc6600"><td style="background-color:#994d00"><td style="background-color:#663300"><td style="background-color:#331900"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#ff9933"><td style="background-color:#cc8033"><td style="background-color:#996633"><td style="background-color:#664d33"><td style="background-color:#333333"><td style="background-color:#2a2a2b">
			<tr>
				<th>40%<td style="background-color:#ffb366"><td style="background-color:#cc9966"><td style="background-color:#998066"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#ffcc99"><td style="background-color:#ccb399"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ffe6cc"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d4d5d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">60° Yellows
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#ffff00"><td style="background-color:#cccc00"><td style="background-color:#999900"><td style="background-color:#666600"><td style="background-color:#333300"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#ffff33"><td style="background-color:#cccc33"><td style="background-color:#999933"><td style="background-color:#666633"><td style="background-color:#333333"><td style="background-color:#2a2a2b">
			<tr>
				<th>40%<td style="background-color:#ffff66"><td style="background-color:#cccc66"><td style="background-color:#999966"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#ffff99"><td style="background-color:#cccc99"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ffffcc"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d4d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">90° Yellow-Greens
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#80ff00"><td style="background-color:#66cc00"><td style="background-color:#4d9900"><td style="background-color:#336600"><td style="background-color:#1a3300"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#99ff33"><td style="background-color:#80cc33"><td style="background-color:#669933"><td style="background-color:#4d6633"><td style="background-color:#333333"><td style="background-color:#2a2a2b">
			<tr>
				<th>40%<td style="background-color:#b3ff66"><td style="background-color:#99cc66"><td style="background-color:#809966"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#ccff99"><td style="background-color:#b3cc99"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#e6ffcc"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d4d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">120° Greens
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#00ff00"><td style="background-color:#00cc00"><td style="background-color:#009900"><td style="background-color:#006600"><td style="background-color:#003300"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#33ff33"><td style="background-color:#33cc33"><td style="background-color:#339933"><td style="background-color:#336633"><td style="background-color:#333333"><td style="background-color:#2b2a2b">
			<tr>
				<th>40%<td style="background-color:#66ff66"><td style="background-color:#66cc66"><td style="background-color:#669966"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#99ff99"><td style="background-color:#99cc99"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ccffcc"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d4d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">150° Green-Cyans
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#00ff7f"><td style="background-color:#00cc66"><td style="background-color:#00994c"><td style="background-color:#006633"><td style="background-color:#003319"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#33ff99"><td style="background-color:#33cc7f"><td style="background-color:#339966"><td style="background-color:#33664c"><td style="background-color:#333333"><td style="background-color:#2b2a2a">
			<tr>
				<th>40%<td style="background-color:#66ffb2"><td style="background-color:#66cc99"><td style="background-color:#66997f"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#99ffcc"><td style="background-color:#99ccb3"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ccffe5"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d4d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">180° Cyans
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#00ffff"><td style="background-color:#00cccc"><td style="background-color:#009999"><td style="background-color:#006666"><td style="background-color:#003333"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#33ffff"><td style="background-color:#33cccc"><td style="background-color:#339999"><td style="background-color:#336666"><td style="background-color:#333333"><td style="background-color:#2b2a2a">
			<tr>
				<th>40%<td style="background-color:#66ffff"><td style="background-color:#66cccc"><td style="background-color:#669999"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#99ffff"><td style="background-color:#99cccc"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ccffff"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d5d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">210° Cyan-Blues
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#007fff"><td style="background-color:#0066cc"><td style="background-color:#004c99"><td style="background-color:#003366"><td style="background-color:#001933"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#3399ff"><td style="background-color:#337fcc"><td style="background-color:#336699"><td style="background-color:#334c66"><td style="background-color:#333333"><td style="background-color:#2b2a2a">
			<tr>
				<th>40%<td style="background-color:#66b2ff"><td style="background-color:#6699cc"><td style="background-color:#667f99"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#99ccff"><td style="background-color:#99b3cc"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#cce5ff"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d5d4"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">240° Blues
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#0000ff"><td style="background-color:#0000cc"><td style="background-color:#000099"><td style="background-color:#000066"><td style="background-color:#000033"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#3333ff"><td style="background-color:#3333cc"><td style="background-color:#333399"><td style="background-color:#333366"><td style="background-color:#333333"><td style="background-color:#2b2b2a">
			<tr>
				<th>40%<td style="background-color:#6666ff"><td style="background-color:#6666cc"><td style="background-color:#666699"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#9999ff"><td style="background-color:#9999cc"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ccccff"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d5d4"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">270° Blue-Magentas
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#7f00ff"><td style="background-color:#6600cc"><td style="background-color:#4c0099"><td style="background-color:#330066"><td style="background-color:#190033"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#9933ff"><td style="background-color:#7f33cc"><td style="background-color:#663399"><td style="background-color:#4c3366"><td style="background-color:#333333"><td style="background-color:#2a2b2a">
			<tr>
				<th>40%<td style="background-color:#b266ff"><td style="background-color:#9966cc"><td style="background-color:#7f6699"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#cc99ff"><td style="background-color:#b399cc"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#e5ccff"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d5d5d4"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">300° Magentas
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#ff00ff"><td style="background-color:#cc00cc"><td style="background-color:#990099"><td style="background-color:#660066"><td style="background-color:#330033"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#ff33ff"><td style="background-color:#cc33cc"><td style="background-color:#993399"><td style="background-color:#663366"><td style="background-color:#333333"><td style="background-color:#2a2b2a">
			<tr>
				<th>40%<td style="background-color:#ff66ff"><td style="background-color:#cc66cc"><td style="background-color:#996699"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#ff99ff"><td style="background-color:#cc99cc"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ffccff"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d4d5d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>

		<table>
			<tr>
				<th><th colspan="6">330° Magenta-Reds
			<tr>
				<th><span class="white">W</span>\<span class="black">B</span>
				<th>0%<th>20%<th>40%<th>60%<th>80%<th>100%
			<tr>
				<th>0%<td style="background-color:#ff0080"><td style="background-color:#cc0066"><td style="background-color:#99004d"><td style="background-color:#660033"><td style="background-color:#33001a"><td style="background-color:#000000">
			<tr>
				<th>20%<td style="background-color:#ff3399"><td style="background-color:#cc3380"><td style="background-color:#993366"><td style="background-color:#66334d"><td style="background-color:#333333"><td style="background-color:#2a2b2a">
			<tr>
				<th>40%<td style="background-color:#ff66b3"><td style="background-color:#cc6699"><td style="background-color:#996680"><td style="background-color:#666666"><td style="background-color:#555555"><td style="background-color:#494949">
			<tr>
				<th>60%<td style="background-color:#ff99cc"><td style="background-color:#cc99b3"><td style="background-color:#999999"><td style="background-color:#808080"><td style="background-color:#6d6d6d"><td style="background-color:#606060">
			<tr>
				<th>80%<td style="background-color:#ffcce6"><td style="background-color:#cccccc"><td style="background-color:#aaaaaa"><td style="background-color:#929292"><td style="background-color:#808080"><td style="background-color:#717171">
			<tr>
				<th>100%<td style="background-color:#ffffff"><td style="background-color:#d4d5d5"><td style="background-color:#b6b6b6"><td style="background-color:#9f9f9f"><td style="background-color:#8e8e8e"><td style="background-color:#808080">
		</table>
	</div>

<!--
██          ███    ████████        ██        ██████  ██     ██
██         ██ ██   ██     ██       ██       ██    ██ ██     ██
██        ██   ██  ██     ██       ██       ██       ██     ██
██       ██     ██ ████████        ██       ██       █████████
██       █████████ ██     ██       ██       ██       ██     ██
██       ██     ██ ██     ██       ██       ██    ██ ██     ██
████████ ██     ██ ████████        ████████  ██████  ██     ██
-->

<h2 id='lab-colors'>
Device-independent Colors: CIE Lab and LCH, Oklab and OkLCh</h2>

<h3 id="cie-lab" class="informative">CIE Lab and LCH</h3>

	<em>This section is not normative.</em>

	<wpt title="This section is not normative, it does not need tests."></wpt>

	Physical measurements of a color are typically expressed in the CIE L*a*b* [[!CIELAB]] color space,
	created in 1976 by the <abbr title="Commission Internationale de l'Eclairage">CIE</abbr>
	and commonly referred to simply as Lab.
	Color conversions from one device to another may also use Lab as an intermediate step.
	Derived from human vision experiments,
	Lab represents the entire range of color that humans can see.

	<!-- Simplify by saying Lab throughout rather than CIELab or
	CIE L*a*b*, because that is what people write in practice.
	No-one has used Hunter Lab for anything for decades.  -->
	<!-- But now we have Oklab so where it matters, be more specific -->

	Lab is a rectangular coordinate system
	with a central Lightness (L) axis.
	This value is usually written as a unitless number;
	for compatibility with the rest of CSS, it may also be written as a percentage.
	100% means an L value of 100, not 1.0.
	L=0% or 0 is deep black (no light at all)
	while L=100% or 100 is a diffuse white.

	Usefully, L=50% or 50 is mid gray, by design,
	and equal increments in L are evenly spaced visually:
	the Lab color space is intended to be <em>perceptually uniform</em>.

	<figure id="lightness-vs-luminance">
		<img src="images/L-axis.svg" width=240 height=575 alt="">
		<img src="images/Luminance.svg" width=240 height=575 alt="">
		<figcaption>
			This figure shows, to the left, the Lightness axis of the CIE Lab color space.
			Twenty-one neutral swatches are shown (L=0%, L=5%, to L=100%).
			The steps are equally spaced, visually.
			To the right, the same number of steps in [=luminance=]
			are equally spaced in light energy but <strong>not</strong> equally spaced visually.
		</figcaption>
	</figure>

	The a and b axes convey hue;
	positive values along the a axis are a purplish red
	while negative values are the complementary color, a green.
	Similarly, positive values along the b axis are yellow
	and negative are the complementary blue/violet.
	Desaturated colors have small values of a and b
	and are close to the L axis;
	saturated colors lie far from the L axis.


	<!-- diagram here -->

	The illuminant is [=D50=] white, a standardized daylight spectrum with a color temperature of 5000K,
	as reflected by a perfect diffuse reflector; it approximates the color of sunlight on a sunny day.
	D50 is also the whitepoint used for the profile connection space in ICC color interconversion,
	the whitepoint used in image editors which offer Lab editing,
	and the value used by physical measurement devices
	such as spectrophotometers and spectroradiometers,
	when they report measured colors in Lab.

	Conversion from colors specified using other white points is called a <dfn export>chromatic adaptation transform</dfn>,
	which models the changes in the human visual system as we adapt to a new lighting condition.
	The linear Bradford algorithm [[!ICC]]
	(a simplification of the original Bradford algorithm [[!Bradford-CAT]])
	is the industry standard chromatic adaptation transform,
	and is easy to calculate as it is a simple matrix multiplication.

	CIE  LCH has the same L axis as Lab,
	but uses polar coordinates C (chroma) and H (hue),
	making it a polar, cylindrical coordinate system.
	C is the geometric distance from the L axis
	and H is the angle from the positive a axis,
	towards the positive b axis.

	<figure id="fig-cie-lch-hues">
		<img src="images/CH-plane-wheel.svg" width="500" height="500">
		<figcaption>
			This figure shows the L=50 plane of the CIE Lab color space.
			20 degree increments in CIE LCH are displayed as circles
			at three levels of Chroma: 20, 40 and 60.
			All the 20 Chroma colors fit inside sRGB gamut,
			some of 40 and 60 Chroma are outside.
			These out of gamut colors are visualized as grey, with a red warning outer stroke.
		</figcaption>
	</figure>

	<!-- because Luv is not widely used nowadays, no need to say LCH(ab)
	to distinguish from LCH(uv) -->

	<p class="note">Note: The L axis in Lab and LCH
	is not to be confused with the L axis in HSL.
	For example, in HSL, the sRGB colors blue (#00F) and yellow (#FF0)
	have the same value of L (50%) even though visually, blue is much darker.
	This is much clearer in Lab:
	sRGB blue is lab(29.567% 68.298 -112.0294)
	while
	sRGB yellow is lab(97.607% -15.753 93.388).
	In Lab and LCH, if two colors have the same measured L value,
	they have identical visual lightness.
	HSL and related polar RGB models were developed
	in an attempt
	to give similar usability benefits for RGB that LCH gave to Lab,
	but are significantly less accurate.</p>

	Although the use of CIE Lab and LCH is widespread,
	it is known to have some problems. In particular:

	<dl>
		<dt>Hue linearity</dt>
		<dd>
			In the blue region (LCH Hue between 270° and 330°),
			visual hue departs from what LCH predicts.
			Plotting a set of blues of the same hue and differing Chroma,
			which should lie on a straight line from the neutral axis,
			instead form a curve.
			Put another way,
			as a saturated blue has it's Chroma progressively reduced,
			it becomes noticeably purple.
		</dd>
		<dt>Hue uniformity</dt>
		<dd>
			While hues in LCH are in general evenly spaced,
			(and far better than HSL or HWB),
			uniformity is not perfect.
		</dd>
		<dt>Over-prediction of high Chroma differences</dt>
		<dd>
			For high Chroma colors,
			changes in Chroma are less noticeable
			than for more neutral colors.
		</dd>
	</dl>

	These deficiencies affect, for example,
	creation of evenly spaced gradients,
	gamut mapping from one color space to a smaller one,
	and computation of the visual difference between two colors.

	To compensate for this,
	formulae to predict the visual difference between two colors
	(delta E)
	have been made more accurate over time
	(but also, much more complex to compute).
	The current industry standard formula,
	delta E 2000,
	works well to mitigate some of the Lab and LCH problems.
	A sample implementation is given in
	[[#color-difference-2000]].

	This does not help with hue curvature, however.

	<h3 id="ok-lab" class="informative">Oklab and OkLCh</h3>

	<em>This section is not normative.</em>
	<wpt title="This section is not normative, it does not need tests."></wpt>

	Recently, Oklab,
	an improved Lab-like space has been developed [[!Oklab]].
	The corresponding polar form is called OkLCh.
	It was produced by numerical optimization
	of a large dataset of visually similar colors,
	and has improved hue linearity,
	hue uniformity,
	and chroma uniformity
	compared to CIE LCH.

	Like CIE Lab, there is a central lightness L axis
	which is usually written as a unitless number in the range [0,1];
	for compatibility with the rest of CSS,
	it may be written as a percentage. 100% means an L value of 1.0.
	L=0% or 0.0 is deep black (no light at all) while L=100% or 1.0 is a diffuse white.

	Note: Unlike CIE Lab, which assumes adaptation to the diffuse white,
	Oklab assumes adaptation to the color being defined,
	which is intended to make it scale invariant.

	As with CIE Lab, the a and b axes convey hue;
	positive values along the a axis are a purplish red
	while negative values are the complementary color, a green.
	Similarly, positive values along the b axis are yellow
	and negative are the complementary blue/violet.

	The illuminant is [=D65=], the same white point
	as most RGB color spaces.

	OkLCh has the same L axis as Oklab,
	but uses polar coordinates C (chroma) and H (hue).

	Note: Unlike CIE LCH, where Chroma can reach values of 200 or more,
	OkLCh Chroma ranges to 0.5 or so.
	The hue angles between CIE LCH and OkLCh are broadly similar,
	but not identical.

	<figure id="CIELCH-blue-hueshift">
		<img src="images/CIELCH-blue-slice.png" width="2434" height="1848"
			alt="diagram showing purpling in CIE LCH">
		<figcaption>A constant CIE LCH hue slice,
			showing the sRGB gamut around primary blue.
			A noticeable purpling is immediately evident.
		</figcaption>
	</figure>

	<figure id="OkLCh-blue-no-hueshift">
		<img src="images/OKLCH-blue-slice.png" width="2485" height="1824"
			alt="diagram showing hue constancy in OkLCh">
		<figcaption>A constant OkLCh hue slice,
			showing the sRGB gamut around primary blue.
			The visual hue remains constant.
		</figcaption>
	</figure>

	Because Oklab is more perceptually uniform than CIE Lab,
	the color difference is a straightforward distance in 3D space
	(root sum of squares).
	Although trivial,
	a sample implementation is give in
	[[#color-difference-OK]].

<h3 id="specifying-lab-lch">
Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
	<!-- lab rather than CIELab or whatever, for brevity -->

	<!-- browser tracking bugs:
		Chromium
		https://bugs.chromium.org/p/chromium/issues/detail?id=1026287

		WebKit
		https://bugs.webkit.org/show_bug.cgi?id=205675
		and
		https://bugs.webkit.org/show_bug.cgi?id=220684

		Gecko
		https://bugzilla.mozilla.org/show_bug.cgi?id=1352757
		and
		https://bugzilla.mozilla.org/show_bug.cgi?id=1632548

	-->

	CSS allows colors to be directly expressed in Lab and LCH.

	<pre class='prod'>
	<dfn>lab()</dfn> = lab( [<<percentage>> | <<number>> | none]
				[ <<percentage>> | <<number>> | none]
				[ <<percentage>> | <<number>> | none]
				[ / [<<alpha-value>> | none] ]? )
	</pre>

	<table id="prr-lab">
		<tr>
			<th>Percentages</th>
			<td>Allowed for L, a and b</td>
		</tr>
		<tr>
			<th>Percent reference range&nbsp;</th>
			<td>
				for L: 0% = 0.0, 100% = 100.0<br>
				for a and b: -100% = -125, 100% = 125
			</td>
		</tr>
	</table>

	<wpt>
		lab-001.html
		lab-002.html
		lab-003.html
		lab-004.html
		lab-005.html
		lab-006.html
		lab-007.html
		lab-008.html
		lab-l-over-100-1.html
		lab-l-over-100-2.html
		parsing/color-valid.html
		parsing/color-computed-lab.html
		parsing/color-invalid-lab.html
		parsing/color-valid-lab.html
	</wpt>

	In <dfn value export for="lab()">Lab</dfn>,
	the first argument specifies the CIE Lightness, L.
	This is a number between ''0%'' or 0
	and ''100%'' or 100
	Values less than ''0%'' or 0 must be clamped to ''0%'' at parsed-value time;
	values greater than
	''100%'' or 100 are clamped to ''100%'' at parsed-value time.

	The second and third arguments are the distances along the "a" and "b" axes
	in the Lab color space,
	as described in the previous section.
	These values are signed
	(allow both positive and negative values)
	and theoretically unbounded
	(but in practice do not exceed ±160
	for real-world colors).

	There is an optional fourth <<alpha-value>> component,
	separated by a slash,
	representing the [=alpha component=].

	If the lightness of a Lab color (after clamping) is ''0%'',
	or ''100%''
	the color will be displayed as black, or white, respectively
	due to gamut mapping to the display.

	<div class="example" id="ex-lab-samples">
		<pre class="lang-css">
			<span class="swatch" style="--color: rgb(49.06% 13.87% 15.9%)"></span> lab(29.2345% 39.3825 20.0664);
			<span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lab(52.2345 40.1645 59.9971);
			<span class="swatch" style="--color: rgb(61.65% 57.51% 9.28%)"></span> lab(60.2345 -5.3654 58.956);
			<span class="swatch" style="--color: rgb(40.73% 65.12% 22.35%)"></span> lab(62.2345% -34.9638 47.7721);
			<span class="swatch" style="--color: rgb(38.29% 67.27% 93.85%)"></span> lab(67.5345 -8.6911 -41.6019);
			<span class="swatch" style="--color: rgb(50.2% 0% 50.2%)"></span> lab(29.69% 44.888% -29.04%)
		</pre>
	</div>

	<pre class='prod'>
	<dfn>lch()</dfn> = lch( [<<percentage>> | <<number>> | none]
				[ <<percentage>> | <<number>> | none]
				[ <<hue>> | none]
				[ / [<<alpha-value>> | none] ]? )
	</pre>

	<table id="prr-lch">
		<tr>
			<th>Percentages</th>
			<td>Allowed for L and C</td>
		</tr>
		<tr>
			<th>Percent reference range&nbsp;</th>
			<td>
				for L: 0% = 0.0, 100% = 100.0<br>
				for C: 0% = 0, 100% = 150
			</td>
		</tr>
		<tr>
			<th>Powerless hue ε</th>
			<td>C &lt;= 0.0015</td>
		</tr>
	</table>

	<wpt>
		lch-001.html
		lch-002.html
		lch-003.html
		lch-004.html
		lch-005.html
		lch-006.html
		lch-007.html
		lch-008.html
		lch-009.html
		lch-010.html
		lch-l-over-100-1.html
		lch-l-over-100-2.html
		parsing/color-valid.html
	</wpt>

	In CIE <dfn value export for="lch()">LCH</dfn>
	the first argument specifies the CIE Lightness L,
	interpreted identically to the Lightness argument of ''lab()''.

	The second argument is the chroma C,
	(roughly representing the "amount of color").
	Its minimum useful value is ''0'',
	while its maximum is theoretically unbounded
	(but in practice does not exceed ''230'').
	If the provided value is negative,
	it is clamped to ''0'' at parsed-value time.

	The third argument is the hue angle H.
	It's interpreted similarly to the <<hue>> argument of ''hsl()'',
	but doesn't map hues to angles in the same way
	because they are evenly spaced perceptually.
	Instead, ''0deg'' points along the positive "a" axis (toward purplish red),
	(as does ''360deg'', ''720deg'', etc.);
	''90deg'' points along the positive "b" axis (toward mustard yellow),
	''180deg'' points along the negative "a" axis (toward greenish cyan),
	and ''270deg'' points along the negative "b" axis (toward sky blue).

	There is an optional fourth <<alpha-value>> component,
	separated by a slash,
	representing the [=alpha component=].

	If the chroma of an LCH color is ''0%'',
	the hue component is [=powerless=].
	If the lightness of an LCH color (after clamping) is ''0%'',
	or ''100%'',
	the color will be displayed as black, or white, respectively
	due to gamut mapping to the display.

	<div class="example" id="ex-lch-samples">
		<pre class="lang-css">
			<span class="swatch" style="--color: rgb(49.06% 13.87% 15.9%)"></span> lch(29.2345% 44.2 27);
			<span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lch(52.2345% 72.2 56.2);
			<span class="swatch" style="--color: rgb(61.65% 57.51% 9.28%)"></span> lch(60.2345 59.2 95.2);
			<span class="swatch" style="--color: rgb(40.73% 65.12% 22.35%)"></span> lch(62.2345% 59.2 126.2);
			<span class="swatch" style="--color: rgb(38.29% 67.27% 93.85%)"></span> lch(67.5345% 42.5 258.2);
			<span class="swatch" style="--color: rgb(50.2% 0% 50.2%)"></span> lch(29.69% 45.553% 327.1)
		</pre>
	</div>

	There is no Web compatibility issue
	with ''lab'' or ''lch''', which are new in this level of the specification, and so
	''lab()'' and ''lch()'' do <em>not</em> support a <a>legacy color syntax</a>
	that separates all of their arguments with commas.
	Using commas inside these functions is an error.

<h3 id="specifying-oklab-oklch">
	Specifying Oklab and OkLCh: the ''oklab()'' and ''oklch()'' functional notations</h3>

	CSS allows colors to be directly expressed in Oklab and OkLCh.

	<pre class='prod'>
	<dfn>oklab()</dfn> = oklab( [ <<percentage>> | <<number>> | none]
			[ <<percentage>> | <<number>> | none]
			[ <<percentage>> | <<number>> | none]
			[ / [<<alpha-value>> | none] ]? )
	</pre>

	<table id="prr-oklab">
		<tr>
			<th>Percentages</th>
			<td>Allowed for L, a and b</td>
		</tr>
		<tr>
			<th>Percent reference range&nbsp;</th>
			<td>
				for L: 0% = 0.0, 100% = 1.0<br>
				for a and b: -100% = -0.4, 100% = 0.4
			</td>
		</tr>
	</table>

	<wpt>
		oklab-001.html
		oklab-002.html
		oklab-003.html
		oklab-004.html
		oklab-005.html
		oklab-006.html
		oklab-007.html
		oklab-008.html
		oklab-009.html
		oklab-l-almost-0.html
		oklab-l-almost-1.html
		oklab-l-over-1-1.html
		oklab-l-over-1-2.html
		parsing/color-valid.html
	</wpt>

	In <dfn value export for="oklab()">Oklab</dfn>
	the first argument specifies the Oklab Lightness.
	This is a number between ''0%'' or 0
	and ''100%'' or 1.0.

	Values less than ''0%'' or 0.0 must be clamped to ''0%''
	at parsed-value time;
	values greater than ''100%'' or 1.0 are clamped to ''100%''
	at parsed-value time.

	The second and third arguments are the distances along
	the "a" and "b" axes
	in the Oklab color space,
	as described in the previous section.
	These values are signed
	(allow both positive and negative values)
	and theoretically unbounded
	(but in practice do not exceed ±0.5).

	There is an optional fourth <<alpha-value>> component,
	separated by a slash,
	representing the [=alpha component=].

	If the lightness of an Oklab color is ''0%'' or 0,
	or ''100%'' or 1.0,
	the color will be displayed as black, or white, respectively
	due to gamut mapping to the display.

	<div class="example" id="ex-oklab-samples">
		<pre class="lang-css">
			<span class="swatch" style="--color: rgb(49.06% 13.87% 15.9%)"></span> oklab(40.101% 0.1147 0.0453);
			<span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> oklab(59.686% 0.1009 0.1192);
			<span class="swatch" style="--color: rgb(61.65% 57.51% 9.28%)"></span> oklab(0.65125 -0.0320 0.1274);
			<span class="swatch" style="--color: rgb(40.73% 65.12% 22.35%)"></span> oklab(66.016% -0.1084 0.1114);
			<span class="swatch" style="--color: rgb(38.29% 67.27% 93.85%)"></span> oklab(72.322% -0.0465 -0.1150);
			<span class="swatch" style="--color: rgb(50.2% 0% 50.2%)"></span> oklab(42.1% 41% -25%)
		</pre>
	</div>

	<pre class='prod'>
		<dfn>oklch()</dfn> = oklch( [ <<percentage>> | <<number>> | none]
					[ <<percentage>> | <<number>> | none]
					[ <<hue>> | none]
					[ / [<<alpha-value>> | none] ]? )
		</pre>

		<table id="prr-oklch">
			<tr>
				<th>Percentages</th>
				<td>Allowed for L and C</td>
			</tr>
			<tr>
				<th>Percent reference range&nbsp;</th>
				<td>
					for L: 0% = 0.0, 100% = 1.0<br>
					for C: 0% = 0.0 100% = 0.4
				</td>
			</tr>
			<tr>
				<th>Powerless hue ε</th>
				<td>C &lt;= 0.000004</td>
			</tr>
		</table>

		<wpt>
			oklch-001.html
			oklch-002.html
			oklch-003.html
			oklch-004.html
			oklch-005.html
			oklch-006.html
			oklch-007.html
			oklch-008.html
			oklch-009.html
			oklch-010.html
			oklch-011.html
			oklch-l-almost-0.html
			oklch-l-almost-1.html
			oklch-l-over-1-1.html
			oklch-l-over-1-2.html
			parsing/color-valid.html
		</wpt>

		In <dfn value export for="oklch()">OkLCh</dfn>
		the first argument specifies the OkLCh Lightness L,
		interpreted identically to the Lightness argument of ''oklab()''.

		The second argument is the chroma C.
		Its minimum useful value is ''0'',
		while its maximum is theoretically unbounded
		(but in practice does not exceed ''0.5'').
		If the provided value is negative,
		it is clamped to ''0'' at parsed-value time.

		The third argument is the hue angle H.
		It's interpreted similarly to the <<hue>> arguments
			of ''hsl()'' and ''lch()'',
		but doesn't map hues to angles in the same way.
		''0deg'' points along the positive "a" axis (toward purplish red),
		(as does ''360deg'', ''720deg'', etc.);
		''90deg'' points along the positive "b" axis (toward mustard yellow),
		''180deg'' points along the negative "a" axis (toward greenish cyan),
		and ''270deg'' points along the negative "b" axis (toward sky blue).

		There is an optional fourth <<alpha-value>> component,
		separated by a slash,
		representing the [=alpha component=].

		If the chroma of an OkLCh color is ''0%'' or 0,
		the hue component is [=powerless=].
		If the lightness of an OkLCh color is ''0%'' or 0,
		or ''100%'' or 1.0,
		the color will be displayed as black, or white, respectively
		due to gamut mapping to the display.

		<div class="example" id="ex-oklch-samples">
			<pre class="lang-css">
				<span class="swatch" style="--color: rgb(49.06% 13.87% 15.9%)"></span> oklch(40.101% 0.12332 21.555);
				<span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> oklch(59.686% 0.15619 49.7694);
				<span class="swatch" style="--color: rgb(61.65% 57.51% 9.28%)"></span> oklch(0.65125 0.13138 104.097);
				<span class="swatch" style="--color: rgb(40.73% 65.12% 22.35%)"></span> oklch(0.66016 0.15546 134.231);
				<span class="swatch" style="--color: rgb(38.29% 67.27% 93.85%)"></span> oklch(72.322% 0.12403 247.996);
				<span class="swatch" style="--color: rgb(50.2% 0% 50.2%)"></span> oklch(42.1% 48.25% 328.4)
			</pre>
		</div>

	There is no Web compatibility issue
	with ''oklab'' or ''oklch''', which are new in this level of the specification, and so
	''oklab()'' and ''oklch()'' do <em>not</em> support a <a>legacy color syntax</a>
	that separates all of their arguments with commas.
	Using commas inside these functions is an error.


<h3 id='lab-to-lch'>
Converting Lab or Oklab colors to LCH or OkLCh colors</h3>

	Conversion to the polar form is trivial:

	<ol>
		<li>C = sqrt(a^2 + b^2)
		<li>if (C > epsilon) H = atan2(b, a) else H is missing
		<li>L is the same
	</ol>

For extremely small values of a and b (near-zero Chroma),
although the visual color does not change from being on the neutral axis,
small changes to the values can result in the reported hue angle swinging about wildly
and being essentially random.
In CSS, this means the hue is [=powerless=],
and treated as [=missing=] when converted into LCH or OkLCh;
in non-CSS contexts this might be reflected as a missing value, such as NaN.

<h3 id='lch-to-lab'>
Converting LCH or OkLCh colors to Lab or Oklab colors</h3>

	Conversion to the rectangular form is trivial:

	<ol>
		<li>If H is missing, a = b = 0</li>
		<li>Otherwise,
		<ol>
			<li>a = C cos(H)
			<li>b = C sin(H)
		</ol>
		</li>
		<li>L is the same
	</ol>

<!-- gray() removed in #4621
https://github.com/w3c/csswg-drafts/issues/4621
-->

<!--
████████  ████████  ████████ ████████  ████████ ████████ ████ ██    ██ ████████ ████████
██     ██ ██     ██ ██       ██     ██ ██       ██        ██  ███   ██ ██       ██     ██
██     ██ ██     ██ ██       ██     ██ ██       ██        ██  ████  ██ ██       ██     ██
████████  ████████  ██████   ██     ██ ██████   ██████    ██  ██ ██ ██ ██████   ██     ██
██        ██   ██   ██       ██     ██ ██       ██        ██  ██  ████ ██       ██     ██
██        ██    ██  ██       ██     ██ ██       ██        ██  ██   ███ ██       ██     ██
██        ██     ██ ████████ ████████  ████████ ██       ████ ██    ██ ████████ ████████
-->

<!--
	https://caniuse.com/mdn-css_types_color_color
 -->
<h2 id='predefined'>
Predefined Color Spaces</h2>

	CSS provides several predefined color spaces
	including ''display-p3'' [[!Display-P3]],
	which is a wide gamut space typical of current wide-gamut monitors,
	''prophoto-rgb'', widely used by photographers
	and ''rec2020'' [[!Rec.2020]],
	which is a broadcast industry standard,
	ultra-wide gamut space capable of representing almost all visible real-world colors.


<!--
 ██████   ███████  ██        ███████  ████████    ███    ███
██    ██ ██     ██ ██       ██     ██ ██     ██  ██        ██
██       ██     ██ ██       ██     ██ ██     ██ ██          ██
██       ██     ██ ██       ██     ██ ████████  ██          ██
██       ██     ██ ██       ██     ██ ██   ██   ██          ██
██    ██ ██     ██ ██       ██     ██ ██    ██   ██        ██
 ██████   ███████  ████████  ███████  ██     ██   ███    ███
-->

<h3 id="color-function">
Specifying Predefined Colors: the ''color()'' function</h3>

	The ''color()'' function allows a color to be specified
	in a particular, specified [=color space=]
	(rather than the implicit sRGB color space that most of the other color functions operate in).
	Its syntax is:

	<!-- <pre class='prod'>
		<dfn>color()</dfn> = color( [<<ident>> | <<dashed-ident>>] [<<number-percentage>> | none]+ [ / [<<alpha-value>> | none] ]? )
	</pre> -->

	<!-- this one from Color 5,
		then cut down to remove color 5-specific bits
		like RCS and custom colors
	-->
	<pre class='prod'>
		<dfn>color()</dfn> = color( <<colorspace-params>> [ / [ <<alpha-value>> | none ] ]? )
		<dfn>&lt;colorspace-params></dfn> = [ <<predefined-rgb-params>> | <<xyz-params>>]
		<dfn>&lt;predefined-rgb-params></dfn> = <<predefined-rgb>> [ <<number>> | <<percentage>> | none ]{3}
		<dfn>&lt;predefined-rgb></dfn> = <l>''srgb''</l> | <l>''srgb-linear''</l> | <l>''display-p3''</l> | <l>''display-p3-linear''</l> | <l>''a98-rgb''</l> | <l>''prophoto-rgb''</l> | <l>''rec2020''</l>
		<dfn>&lt;xyz-params></dfn> = <<xyz-space>> [ <<number>> | <<percentage>> | none ]{3}
		<dfn>&lt;xyz-space></dfn> = <l>''xyz''</l> | <l>''xyz-d50''</l> | <l>''xyz-d65''</l>
	</pre>

	<wpt>
		parsing/color-computed-color-function.html
		parsing/color-invalid-color-function.html
		parsing/color-valid-color-function.html
	</wpt>

	The color function takes parameters specifying a color, in an explicitly listed color space.

	It represents either an [=invalid color=], as described below,
	or a [=valid color=].

	The parameters have the following form:

	* An <<ident>> denoting
		one of the <a href="#predefined">predefined color spaces</a>
		(such as ''display-p3'')
		Individual <a href="#predefined">predefined color spaces</a>
		may further restrict whether <<number>>s or <<percentage>>s
		or both, may be used.

		If the <<ident>> names a non-existent color space
		(a name that does not match one of the <a href="#predefined">predefined color spaces</a>),
		this argument represents an <a>invalid color</a>.


	* The three parameter values that the color space takes (RGB or XYZ values).

	An out of gamut color has component values
	less than 0 or 0%, or greater than 1 or 100%.
	These are not invalid, and are retained for intermediate computations;
	instead, for display, they are
	<a>css gamut mapped</a> using a relative colorimetric intent
	which brings the values
	(in the display color space)
	within the range 0/0% to 1/100%
	at actual-value time.


	* An optional slash-separated <<alpha-value>>.

	<wpt>
		parsing/color-valid.html
	</wpt>

	There is no Web compatibility issue
	with ''color()'', which is new in this level of the specification, and so
	''color()'' does <em>not</em> support a <a>legacy color syntax</a>
	that separates all of its arguments with commas.
	Using commas inside this function is an error.

	A color which is either an [=invalid color=] or
	an [=out of  gamut=] color
	<dfn export>can't be displayed</dfn>.

	If the specified color <dfn export>can be displayed</dfn>,
	(that is, it isn't an [=invalid color=]
	and isn't [=out of gamut=])
	then this is the actual value of the ''color()'' function.

	If the specified color
	is a [=valid color=]
	but [=can't be displayed=],
	the actual value is derived from the specified color,
	<a>css gamut mapped</a> for display.

	If the color is an [=invalid color=],
	the used value is <a>opaque black</a>.


	<div class="example" id="ex-2020-oog-p3">
		This very intense lime color is in-gamut for rec.2020:
		<pre class="lang-css">color(rec2020 0.42053 0.979780 0.00579);</pre>
		in LCH, that color is
		<pre class="lang-css">lch(85.9017% 166.116 138.207);</pre>
		in display-p3, that color is
		<pre class="lang-css">color(display-p3 -0.350289 1.00707 -0.144209);</pre>
		and is out of gamut for display-p3
		(red and blue are negative, green is greater than 1).
		If you have a display-p3 screen, that color is:
		<ul>
			<li><em>valid</em></li>
			<li><em>in gamut</em> (for rec.2020)</li>
			<li><em>out of gamut</em> (for your display)</li>
			<li>and so <em>can't be displayed</em></li>
		</ul>
		The color used for display will be a less intense color
		produced automatically by gamut mapping.
	</div>

	<div class="invalid example" id="ex-profoto-bad">
		This example has a typo!
		An intense green is provided in profoto-rgb space (which doesn't exist).
		This makes it invalid, so the used value is <a>opaque black</a>
		<pre class="lang-css">color(profoto-rgb 0.4835 0.9167 0.2188)</pre>
	</div>


<!-- Browser tracking bugs:
	Chromium https://bugs.chromium.org/p/chromium/issues/detail?id=1068610

	Quick test https://mathiasbynens.github.io/css-dbg-stories/css-color.html
-->

<h3 id="predefined-sRGB">
The Predefined sRGB Color Space: the ''sRGB'' keyword</h3>


	The <dfn id='sRGB-space' export>sRGB</dfn> predefined color space
	defined below
	is the same as is used for legacy sRGB colors,
	such as ''rgb()''.

	<dl dfn-type=value dfn-for="color()">
		<dt><dfn>srgb</dfn>
		<dd>
			The ''srgb'' [[!SRGB]] color space accepts three numeric parameters,
			representing the red, green, and blue components of the color.
			In-gamut colors have all three components in the range [0, 1].
			The whitepoint is [=D65=].


			[[!SRGB]] specifies two viewing conditions, <em>encoding</em>
			and <em>typical</em>. The [[ICC]] recommends using the <em>encoding</em>
			conditions for color conversion and for optimal viewing, which are
			the values in the table below.

			sRGB is the default color space for CSS,
			used for all the legacy color functions.

			It has the following characteristics:

			<table id="prr-color-srgb">
				<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
				<tr><th>Red chromaticity</th><td>0.640</td><td>0.330</td></tr>
				<tr><th>Green chromaticity</th><td>0.300</td><td>0.600</td></tr>
				<tr><th>Blue chromaticity</th><td>0.150</td><td>0.060</td></tr>
				<tr><th>White chromaticity</th> <td  colspan="2">[=D65=]</td></tr>
				<tr><th>Transfer function</th><td colspan="2">see below</td></tr>
				<tr><th>White luminance</th><td colspan="2">80.0 cd/m<sup>2</sup></td></tr>
				<tr><th>Black luminance</th><td colspan="2">0.20 cd/m<sup>2</sup></td></tr>
				<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
				<tr>
					<th>Percentages</th>
					<td  colspan="2">Allowed for R, G and B</td>
				</tr>
				<tr>
					<th>Percent reference range&nbsp;</th>
					<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
				</tr>
			</table>

			<pre class="lang-javascript">
			let sign = c < 0? -1 : 1;
			let abs = Math.abs(c);

			if (abs <= 0.04045) {
				cl = c / 12.92;
			}
			else {
				cl = sign * (Math.pow((abs + 0.055) / 1.055, 2.4));
			}
			</pre>
			c is the gamma-encoded red, green or blue component.
			cl is the corresponding linear-light component.

			<!--
			<figure id="fig-srgb-lch">
				<img src="images/sRGB-prim-sec.svg" width=540 height=520
				alt="diagram of sRGB primaries and secondaries in LCH">
				<figcaption>Visualization of the sRGB color space in LCH. The primaries and secondaries are shown.</figcaption>
			</figure>
			-->

			<figure id="fig-srgb-oklch">
				<img src="images/sRGB-prim-sec-oklch.svg" width=700 height=567
				alt="diagram of sRGB primaries and secondaries in Oklch">
				<figcaption>Visualization of the sRGB color space in Oklch. The primaries and secondaries are shown.</figcaption>
			</figure>

		</dl>

		<wpt>
			predefined-001.html
			predefined-002.html
			parsing/color-valid.html
		</wpt>

<h3 id="predefined-sRGB-linear">
The Predefined Linear-Light sRGB Color Space: the ''srgb-linear'' keyword</h3>


		The <dfn id='sRGB-linear-space' export>sRGB-linear</dfn> predefined color space
		is the same as ''srgb''
		<em>except</em> that the transfer function
		is linear-light (there is no gamma-encoding).

		<dl dfn-type=value dfn-for="color()">
			<dt><dfn>srgb-linear</dfn>
			<dd>
				The ''srgb-linear'' [[!SRGB]] color space accepts three numeric parameters,
				representing the red, green, and blue components of the color.
				In-gamut colors have all three components in the range [0, 1].
				The whitepoint is [=D65=].

				It has the following characteristics:

				<table id="prr-color-srgb-linear">
					<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
					<tr><th>Red chromaticity</th><td>0.640</td><td>0.330</td></tr>
					<tr><th>Green chromaticity</th><td>0.300</td><td>0.600</td></tr>
					<tr><th>Blue chromaticity</th><td>0.150</td><td>0.060</td></tr>
					<tr><th>White chromaticity</th> <td  colspan="2">[=D65=]</td></tr>
					<tr><th>Transfer function</th><td colspan="2">unity, see below</td></tr>
					<tr><th>White luminance</th><td colspan="2">80.0 cd/m<sup>2</sup></td></tr>
					<tr><th>Black luminance</th><td colspan="2">0.20 cd/m<sup>2</sup></td></tr>
					<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
					<tr>
						<th>Percentages</th>
						<td  colspan="2">Allowed for R, G and B</td>
					</tr>
					<tr>
						<th>Percent reference range&nbsp;</th>
						<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
					</tr>
				</table>

				<pre class="lang-javascript">
				cl = c;
				</pre>
				c is the red, green or blue component.
				cl is the corresponding linear-light component, which is identical.


				To avoid banding artifacts, a
				<a href="#predefined-precision-table">higher precision is required</a>
				for ''srgb-linear'' than for ''srgb''.

				<div class="example" id="srgb-linear-swatches">
					For example, these are the same color
					<pre class="lang-css">
					<span class="swatch" style="--color: rgb(69.1% 13.9% 25.9%)"></span> color(srgb 0.691 0.139 0.259)
					<span class="swatch" style="--color: rgb(69.1% 13.9% 25.9%)"></span> color(srgb-linear 0.435 0.017 0.055)
					</pre>
				</div>
			</dd>
		</dl>
		<wpt>
			srgb-linear-001.html
			srgb-linear-002.html
			srgb-linear-003.html
			srgb-linear-004.html
			parsing/color-valid.html

		</wpt>

<h3 id="predefined-display-p3">
The Predefined Display P3 Color Space: the ''display-p3'' keyword</h3>

		<dl dfn-type=value dfn-for="color()">
		<dt><dfn>display-p3</dfn>
		<dd>
			The ''display-p3'' [[!Display-P3]] color space accepts three numeric parameters,
			representing the red, green, and blue components of the color.
			In-gamut colors have all three components in the range [0, 1].
			It uses the same primary chromaticities as [[DCI-P3]],
			but with a [=D65=] whitepoint, and the same transfer curve as sRGB.

			Modern displays, TVs, laptop screens and phone screens
			are able to display all, or nearly all,
			of the display-p3 gamut.

			It has the following characteristics:

			<table id="prr-color-display-p3">
				<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
				<tr><th>Red chromaticity</th><td>0.680</td><td>0.320</td></tr>
				<tr><th>Green chromaticity</th><td>0.265</td><td>0.690</td></tr>
				<tr><th>Blue chromaticity</th><td>0.150</td><td>0.060</td></tr>
				<tr><th>White chromaticity</th> <td  colspan="2">[=D65=]</td></tr>
				<tr><th>Transfer function</th><td colspan="2">same as srgb</td></tr>
				<tr><th>White luminance</th><td colspan="2">80.0 cd/m<sup>2</sup></td></tr>
				<tr><th>Black luminance</th><td colspan="2">0.80 cd/m<sup>2</sup></td></tr>
				<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
				<tr>
					<th>Percentages</th>
					<td  colspan="2">Allowed for R, G and B</td>
				</tr>
				<tr>
					<th>Percent reference range&nbsp;</th>
					<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
				</tr>
			</table>

			<!--
			<figure id="fig-displayp3-lch">
				<img src="images/P3-prim-sec.svg" width=580 height=560
				alt="diagram of P3 primaries and secondaries in LCH">
				<figcaption>Visualization of the P3 color space in LCH.
					The primaries and secondaries are shown
					(but in sRGB, not in the correct colors).
					For comparison, the sRGB primaries and secondaries
					are also shown, as dashed circles.
					P3 primaries have higher Chroma.
				</figcaption>
			</figure>
			-->

			<figure id="fig-displayp3-oklch">
				<img src="images/P3-prim-sec-oklch.svg" width=700 height=557
				alt="diagram of P3 primaries and secondaries in Oklch">
				<figcaption>Visualization of the P3 color space in Oklch.
					The primaries and secondaries are shown
					(but in sRGB, not in the correct colors).
					For comparison, the sRGB primaries and secondaries
					are also shown, as dashed circles.
					P3 primaries have higher Chroma.
				</figcaption>
			</figure>

		</dl>

		<wpt>
			predefined-005.html
			predefined-006.html
			display-p3-001.html
			display-p3-002.html
			display-p3-003.html
			display-p3-004.html
			display-p3-005.html
			display-p3-006.html
		</wpt>
		<wpt pathprefix="/html/canvas/element/wide-gamut-canvas">
			2d.color.space.p3.fillText.html
			2d.color.space.p3.fillText.shadow.html
			2d.color.space.p3.strokeText.html
			2d.color.space.p3.to.p3.html
			2d.color.space.p3.to.srgb.html
			2d.color.space.p3.toBlob.p3.canvas.html
			2d.color.space.p3.toBlob.with.putImageData.html
			2d.color.space.p3.toDataURL.jpeg.p3.canvas.html
			2d.color.space.p3.toDataURL.p3.canvas.html
			2d.color.space.p3.toDataURL.with.putImageData.html
		</wpt>

<h3 id="predefined-display-p3-linear">
The Predefined Linear-Light Display P3 Color Space: the ''display-p3-linear'' keyword</h3>

	<dl dfn-type=value dfn-for="color()">
		<dt><dfn>display-p3-linear</dfn>
		<dd>
			The ''display-p3-linear'' predefined color space
			is the same as ''display-p3''
			<em>except</em> that the transfer function
			is linear-light (there is no gamma-encoding).

			It has the following characteristics:

			<table id="prr-color-display-p3-linear">
				<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
				<tr><th>Red chromaticity</th><td>0.680</td><td>0.320</td></tr>
				<tr><th>Green chromaticity</th><td>0.265</td><td>0.690</td></tr>
				<tr><th>Blue chromaticity</th><td>0.150</td><td>0.060</td></tr>
				<tr><th>White chromaticity</th> <td  colspan="2">[=D65=]</td></tr>
				<tr><th>Transfer function</th><td colspan="2">unity, see below </td></tr>
				<tr><th>White luminance</th><td colspan="2">80.0 cd/m<sup>2</sup></td></tr>
				<tr><th>Black luminance</th><td colspan="2">0.80 cd/m<sup>2</sup></td></tr>
				<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
				<tr>
					<th>Percentages</th>
					<td  colspan="2">Allowed for R, G and B</td>
				</tr>
				<tr>
					<th>Percent reference range&nbsp;</th>
					<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
				</tr>
			</table>

			<pre class="lang-javascript">
				cl = c;
			</pre>

			c is the red, green or blue component.
			cl is the corresponding linear-light component, which is identical.

			To avoid banding artifacts, a
			<a href="#predefined-precision-table">higher precision is required</a>
			for ''display-p3-linear'' than for ''display-p3''.

			<div class="example" id="display-p3-linear-swatches">
				For example, these are the same color
				<pre class="lang-css">
				<span class="swatch" style="--color: rgb(64.55% 2.065% 26.03%)"></span> color(display-p3 0.591 0.123 0.264)
				<span class="swatch" style="--color: rgb(64.55% 2.065% 26.03%)"></span> color(display-p3-linear 0.3081 0.014 0.0567)
				</pre>
			</div>

	</dl>
	<wpt>
		display-p3-linear-001.html
		display-p3-linear-002.html
		display-p3-linear-003.html
		display-p3-linear-004.html
		display-p3-linear-005.html
		display-p3-linear-006.html
	</wpt>

<h3 id="predefined-a98-rgb">
The Predefined A98 RGB Color Space: the ''a98-rgb'' keyword</h3>

		<dl dfn-type=value dfn-for="color()">
		<dt><dfn>a98-rgb</dfn>
		<dd>
			The ''a98-rgb'' color space accepts three numeric parameters,
			representing the red, green, and blue components of the color.
			In-gamut colors have all three components in the range [0, 1].
			The transfer curve is
			a gamma function, close to but not exactly 1/2.2.

			It has the following characteristics:

			<table id="prr-color-a98-rgb">
				<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
				<tr><th>Red chromaticity</th><td>0.6400</td><td>0.3300</td></tr>
				<tr><th>Green chromaticity</th><td>0.2100</td><td>0.7100</td></tr>
				<tr><th>Blue chromaticity</th><td>0.1500</td><td>0.0600</td></tr>
				<tr><th>White chromaticity</th> <td  colspan="2">[=D65=]</td></tr>
				<tr><th>Transfer function</th><td colspan="2">256/563 </td></tr>
				<tr><th>White luminance</th><td colspan="2">160.0 cd/m<sup>2</sup></td></tr>
				<tr><th>Black luminance</th><td colspan="2">0.5557 cd/m<sup>2</sup></td></tr>
				<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
				<tr>
					<th>Percentages</th>
					<td  colspan="2">Allowed for R, G and B</td>
				</tr>
				<tr>
					<th>Percent reference range&nbsp;</th>
					<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
				</tr>
			</table>

			<!--
			<figure id="fig-a89-lch">
				<img src="images/a98-prim-sec.svg" width=640 height=560
				alt="diagram of a98 primaries and secondaries in LCH">
				<figcaption>Visualization of the A98 color space in LCH.
					The primaries and secondaries are shown
					(but in sRGB, not in the correct colors).
					For comparison, the sRGB primaries and secondaries
					are also shown, as dashed circles.
					a98 primaries have higher Chroma,
					especially the yellow, green and cyan.
				</figcaption>
			</figure>
			-->

			<figure id="fig-a89-oklch">
				<img src="images/a98-prim-sec-oklch.svg" width=700 height=563
				alt="diagram of a98 primaries and secondaries in Oklch">
				<figcaption>Visualization of the A98 color space in Oklch.
					The primaries and secondaries are shown
					(but in sRGB, not in the correct colors).
					For comparison, the sRGB primaries and secondaries
					are also shown, as dashed circles.
					a98 primaries have higher Chroma,
					especially the yellow, green and cyan.
				</figcaption>
			</figure>

		</dl>
		<wpt>
			predefined-007.html
			predefined-008.html
			a98rgb-001.html
			a98rgb-002.html
			a98rgb-003.html
			a98rgb-004.html
			parsing/color-valid.html
		</wpt>

<h3 id="predefined-prophoto-rgb">
The Predefined ProPhoto RGB Color Space: the ''prophoto-rgb'' keyword</h3>

		<dl dfn-type=value dfn-for="color()">
		<dt><dfn>prophoto-rgb</dfn>
			<dd>
				The ''prophoto-rgb'' color space accepts three numeric parameters,
				representing the red, green, and blue components of the color.
				In-gamut colors have all three components in the range [0, 1].
				The transfer curve is
				a gamma function with a value of 1/1.8,
				and a small linear portion near black.
				The white point is [=D50=], the same as is used by CIE Lab. Thus,
				conversion to CIE Lab does not require the chromatic adaptation step.

				The ProPhoto RGB space uses hyper-saturated,
				non physically realizable primaries.
				These were chosen to allow
				a wide color gamut and in particular,
				to minimize hue shifts under tonal manipulation.
				It is often used in digital photography as a wide gamut
				color space for the archival version of
				photographic images. The ''prophoto-rgb'' color space allows CSS to
				specify colors that will match colors in such images
				having the same RGB values.

				The ProPhoto RGB space was originally developed by Kodak
				and is described in [[Wolfe]].
				It was standardized by ISO as [[!ROMM]],[[ROMM-RGB]].

				The white luminance is given as a range, and
				the viewing flare (and thus, the black luminance)
				is 0.5% to 1.0% of this.

				It has the following characteristics:

				<table id="prr-color-prophoto-rgb">
					<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
					<tr><th>Red chromaticity</th><td>0.734699</td><td>0.265301</td></tr>
					<tr><th>Green chromaticity</th><td>0.159597</td><td>0.840403</td></tr>
					<tr><th>Blue chromaticity</th><td>0.036598</td><td>0.000105</td></tr>
					<tr><th>White chromaticity</th><td  colspan="2">[=D50=]</td></tr>
					<tr><th>Transfer function</th><td colspan="2">see below </td></tr>
					<tr><th>White luminance</th><td colspan="2">160.0 to 640.0 cd/m<sup>2</sup></td></tr>
					<tr><th>Black luminance</th><td colspan="2">See text</td></tr>
					<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
					<tr>
						<th>Percentages</th>
						<td  colspan="2">Allowed for R, G and B</td>
					</tr>
					<tr>
						<th>Percent reference range&nbsp;</th>
						<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
					</tr>
				</table>

				<pre class="lang-javascript">
					const E = 16/512;
					let sign = c < 0? -1 : 1;
					let abs = Math.abs(c);

					if (abs <= E) {
						cl =  c / 16;
					}
					else {
						cl = sign * Math.pow(c, 1.8);
					}
				</pre>
				c is the gamma-encoded red, green or blue component.
				cl is the corresponding linear-light component.

				<!--
				<figure id="fig-prophoto-lch">
					<img src="images/prophoto-prim-sec.svg" width=780 height=760
					alt="diagram of prophoto primaries and secondaries in LCH">
					<figcaption>Visualization of the prophoto-rgb color space in LCH. The primaries and secondaries are shown
					(but in sRGB, not in the correct colors).
					For comparison, the sRGB primaries and secondaries
					are also shown, as dashed circles.
					prophoto-rgb primaries and secondaries have much higher Chroma,
					but much of this ultrawide gamut
					does not correspond to physically realizable colors.
					</figcaption>
				</figure>
				-->

				<figure id="fig-prophoto-oklch">
					<img src="images/prophoto-prim-sec-oklch.svg" width=700 height=382
					alt="diagram of prophoto primaries and secondaries in Oklch">
					<figcaption>Visualization of the prophoto-rgb color space in Oklch. The primaries and secondaries are shown
					(but in sRGB, not in the correct colors).
					For comparison, the sRGB primaries and secondaries
					are also shown, as dashed circles.
					prophoto-rgb primaries and secondaries have much higher Chroma,
					but much of this ultrawide gamut
					does not correspond to physically realizable colors.
					</figcaption>
				</figure>


		</dl>
		<wpt>
			predefined-009.html
			predefined-010.html
			prophoto-rgb-001.html
			prophoto-rgb-002.html
			prophoto-rgb-003.html
			prophoto-rgb-004.html
			prophoto-rgb-005.html
			parsing/color-valid.html

		</wpt>

<h3 id="predefined-rec2020">
The Predefined ITU-R BT.2020-2 Color Space: the ''rec2020'' keyword</h3>

		<dl dfn-type=value dfn-for="color()">
		<dt><dfn>rec2020</dfn>
		<dd>
			The ''rec2020'' [[!Rec.2020]] color space accepts three numeric parameters,
			representing the red, green, and blue components of the color.
			In-gamut colors have all three components in the range [0, 1],
			("full-range", in video terminology).
			ITU Reference 2020 is used for
			Ultra High Definition, 4k and 8k television.

			The primaries are physically realizable,
			but with difficulty
			as they lie very close to the spectral locus.

			Current displays are unable to reproduce the full gamut of rec2020.
			Coverage is expected to increase over time as displays improve.

			It has the following characteristics:

			<table id="prr-color-rec2020">
				<thead>
					<tr>
						<td></td>
						<td>x</td>
						<td>y</td>
					</tr>
				</thead>
				<tr><th>Red chromaticity</th><td>0.708</td><td>0.292</td></tr>
				<tr><th>Green chromaticity</th><td>0.170</td><td>0.797</td></tr>
				<tr><th>Blue chromaticity</th><td>0.131</td><td>0.046</td></tr>
				<tr><th>White chromaticity</th> <td  colspan="2">[=D65=]</td></tr>
				<tr><th>Transfer function</th><td colspan="2">gamma 2.40, from [[REC_BT.1886]]</td></tr>
				<tr><th>Image state</th><td colspan="2">display-referred</td></tr>
				<tr>
					<th>Percentages</th>
					<td  colspan="2">Allowed for R, G and B</td>
				</tr>
				<tr>
					<th>Percent reference range&nbsp;</th>
					<td>for R,G,B: 0% = 0.0, 100% = 1.0</td>
				</tr>
			</table>

			<!--
			<figure id="fig-rec2020-lch">
				<img src="images/2020-prim-sec.svg" width=670 height=580
				alt="diagram of rec2020 primaries and secondaries in LCH">
				<figcaption>Visualization of the rec2020 color space in LCH. The primaries and secondaries are shown
				(but in sRGB, not in the correct colors).
				For comparison, the sRGB primaries and secondaries
				are also shown, as dashed circles.
				rec2020 primaries have much higher Chroma.
				</figcaption>
			</figure>
			-->

			<figure id="fig-rec2020-oklch">
				<img src="images/2020-prim-sec-oklch.svg" width=700 height=594
				alt="diagram of rec2020 primaries and secondaries in Oklch">
				<figcaption>Visualization of the rec2020 color space in Oklch. The primaries and secondaries are shown
				(but in sRGB, not in the correct colors).
				For comparison, the sRGB primaries and secondaries
				are also shown, as dashed circles.
				rec2020 primaries have much higher Chroma.
				</figcaption>
			</figure>

		</dl>
		<wpt>
			predefined-011.html
			predefined-012.html
			rec2020-001.html
			rec2020-002.html
			rec2020-003.html
			rec2020-004.html
			rec2020-005.html
			parsing/color-valid.html
		</wpt>

<h3 id="predefined-xyz">
The Predefined CIE XYZ Color Spaces: the ''xyz-d50'', ''xyz-d65'', and ''xyz'' keywords</h3>

		<dl dfn-type=value dfn-for="color()">
		<dt><dfn>xyz-d50</dfn>, <dfn>xyz-d65</dfn>, <dfn>xyz</dfn>
			<dd>The ''xyz'' color space accepts three numeric parameters,
				representing the X,Y and Z values.
				It represents the CIE XYZ [[!COLORIMETRY]] color space,
				scaled such that diffuse white has a [=luminance=] (Y) of 1.0.
				and, if necessary, chromatically adapted to the reference white.

				The reference white for ''xyz-d50'' is [=D50=], while
				the reference white for ''xyz-d65''  and ''xyz'' is [=D65=].

				Values greater than 1.0/100% are allowed and must not be clamped;
				colors where Y is greater than 1.0 represent colors brighter than diffuse white.
				Values less than 0/0% are uncommon,
				but can occur as a result of chromatic adaptation,
				and likewise must not be clamped.

				It has the following characteristics:

				<table id="prr-color-xyz">
					<tr>
						<th>Percentages</th>
						<td>Allowed for X,Y,Z</td>
					</tr>
					<tr>
						<th>Percent reference range&nbsp;</th>
						<td>for X,Y,Z: 0% = 0.0, 100% = 1.0</td>
					</tr>
				</table>

				<div class="example" id="ex-xyz">
					These are exactly equivalent:

					<pre class="lang-css">
						<span class="swatch" style="--color: #7654CD"></span> #7654CD
						<span class="swatch" style="--color: #7654CD"></span> rgb(46.27% 32.94% 80.39%)
						<span class="swatch" style="--color: #7654CD"></span> lab(44.36% 36.05 -58.99)
						<span class="swatch" style="--color: #7654CD"></span> color(xyz-d50 0.2005 0.14089 0.4472)
						<span class="swatch" style="--color: #7654CD"></span> color(xyz-d65 0.21661 0.14602 0.59452)
					</pre>
				</div>

				<div class="example" id="ex-xyz-white">
					These colors are exactly equivalent, and represent white:

					<pre class="lang-css">
						<span class="swatch" style="--color: #FFFFFF"></span> #FFFFFF
						<span class="swatch" style="--color: #FFFFFF"></span> color(xyz-d50 0.9643 1 0.8251)
						<span class="swatch" style="--color: #FFFFFF"></span> color(xyz-d65 0.9505 1 1.089)
					</pre>
				</div>

	</dl>
	<wpt>
		predefined-016.html
		xyz-001.html
		xyz-002.html
		xyz-003.html
		xyz-004.html
		xyz-005.html
		xyz-d50-001.html
		xyz-d50-002.html
		xyz-d50-003.html
		xyz-d50-004.html
		xyz-d50-005.html
		xyz-d65-001.html
		xyz-d65-002.html
		xyz-d65-003.html
		xyz-d65-004.html
		xyz-d65-005.html
		parsing/color-valid.html
	</wpt>


<h3 id="predefined-to-lab-oklab">
Converting Predefined Color Spaces to Lab or Oklab</h3>

	For all predefined RGB color spaces,
	conversion to Lab requires several steps,
	although in practice all but the first step are linear calculations and can be combined.

	<!-- make these steps links to the appropriate section in a calculations appendix -->
	<ol id="predefined-to-lab">
		<li>Convert from gamma-encoded RGB to linear-light RGB (undo gamma encoding)
		<li>Convert from linear RGB to CIE XYZ
		<li>If needed, convert from a [=D65=] whitepoint
			(used by ''sRGB'', ''display-p3'', ''a98-rgb'' and ''rec2020'')
			to the [=D50=] whitepoint used in Lab,
			with the linear Bradford transform. ''prophoto-rgb'' already has a [=D50=] whitepoint.
		<li>Convert D50-adapted XYZ to Lab
	</ol>

	Conversion to Oklab is similar,
	but the chromatic adaptation step
	is only needed for ''prophoto-rgb''.

	<ol id="predefined-to-oklab">
		<li>Convert from gamma-encoded RGB to linear-light RGB (undo gamma encoding)
		<li>Convert from linear RGB to CIE XYZ
		<li>If needed, convert from a [=D50=] whitepoint (used by ''prophoto-rgb'')
			to the [=D65=] whitepoint used in Oklab,
			with the linear Bradford transform.
		<li>Convert D65-adapted XYZ to Oklab
	</ol>

	There is sample JavaScript code for these conversions
	in [[#color-conversion-code]].


<h3 id="oklab-lab-to-predefined">
Converting Lab or Oklab to Predefined RGB Color Spaces</h3>

	Conversion from Lab to predefined spaces like ''display-p3'' or ''rec2020''
	also requires multiple steps,
	and again in practice all but the last step are linear calculations and can be combined.

	<ol id="lab-to-predefined">
		<li>Convert Lab to (D50-adapted) XYZ
		<li>If needed, convert from a [=D50=] whitepoint (used by Lab)
			to the [=D65=] whitepoint used in sRGB and most other RGB spaces,
			with the linear Bradford transform. ''prophoto-rgb''' does not require this step.
		<li>Convert from (D65-adapted) CIE XYZ to linear RGB
		<li>Convert from linear-light RGB to RGB (do gamma encoding)
	</ol>

	Conversion from Oklab is similar,
	but the chromatic adaptation step
	is only needed for ''prophoto-rgb''.

	<ol id="oklab-to-predefined">
		<li>Convert Oklab to (D65-adapted) XYZ
		<li>If needed, convert from a [=D65=] whitepoint (used by Oklab)
			to the [=D50=] whitepoint used in ''prophoto-rgb'',
			with the linear Bradford transform.
		<li>Convert from (D65-adapted) CIE XYZ to linear RGB
		<li>Convert from linear-light RGB to RGB (do gamma encoding)
	</ol>


	There is sample JavaScript code for these conversions
	in [[#color-conversion-code]].

	Implementations may choose to implement these steps in some other way
	(for example, using an ICC profile with relative colorimetric rendering intent)
	provided the results are the same for colors inside both the source and destination gamuts.

<h3 id="predefined-to-predefined">
Converting Between Predefined RGB Color Spaces</h3>

	Conversion from one predefined RGB color space to another
	requires multiple steps,
	one of which is only needed when the whitepoints differ.
	To convert from <em>src</em> to <em>dest</em>:

	<ol>
		<li>Convert from gamma-encoded <em>src</em>RGB to linear-light <em>src</em>RGB (undo gamma encoding)
		<li>Convert from linear <em>src</em>RGB to CIE XYZ
		<li>If <em>src</em> and <em>dest</em> have different whitepoints,
			convert the XYZ value from <em>src</em>White to <em>dest</em>White
			with the linear Bradford transform.
		</li>
		<li>Convert from CIE XYZ to linear <em>dest</em>RGB
		<li>Convert from linear-light <em>dest</em>RGB to <em>dest</em>RGB (do gamma encoding)
	</ol>

	There is sample JavaScript code for this conversion
	for the predefined RGB color spaces, in [[#color-conversion-code]].

	<!--
		browser bugs for color()

		Gecko

		Implement color() function from CSS colors level 4
		https://bugzilla.mozilla.org/show_bug.cgi?id=1695376

		Support Wide Gamut Color in CSS with Display-P3
		https://bugzilla.mozilla.org/show_bug.cgi?id=1626624
	 -->

<!--
 ██████  ████ ██     ██ ████████           ███    ██       ████████  ██     ██    ███
██    ██  ██  ███   ███ ██     ██         ██ ██   ██       ██     ██ ██     ██   ██ ██
██        ██  ████ ████ ██     ██        ██   ██  ██       ██     ██ ██     ██  ██   ██
 ██████   ██  ██ ███ ██ ████████        ██     ██ ██       ████████  █████████ ██     ██
      ██  ██  ██     ██ ██              █████████ ██       ██        ██     ██ █████████
██    ██  ██  ██     ██ ██              ██     ██ ██       ██        ██     ██ ██     ██
 ██████  ████ ██     ██ ██              ██     ██ ████████ ██        ██     ██ ██     ██
-->

<h3 id="alpha">
Simple Alpha Compositing</h3>

	When drawing, implementations must handle alpha
	according to the rules in <a href="https://www.w3.org/TR/compositing-1/#simplealphacompositing">Section 5.1 Simple alpha compositing</a> of [[!Compositing]].


<!--
 ██████   ███████  ██    ██ ██     ██ ████████ ████████  ████████
██    ██ ██     ██ ███   ██ ██     ██ ██       ██     ██    ██
██       ██     ██ ████  ██ ██     ██ ██       ██     ██    ██
██       ██     ██ ██ ██ ██ ██     ██ ██████   ████████     ██
██       ██     ██ ██  ████  ██   ██  ██       ██   ██      ██
██    ██ ██     ██ ██   ███   ██ ██   ██       ██    ██     ██
 ██████   ███████  ██    ██    ███    ████████ ██     ██    ██
-->

<h2 id="color-conversion" algorithm="to convert a color">
Converting Colors</h2>

<wpt title="This section provides algorithms used later, it does not need tests."></wpt>

Colors may be converted
from one color space to another and,
provided that there is no gamut mapping
and that each color space can represent out of gamut colors,
(for RGB spaces, this means that the transfer function is defined over the extended range)
then (subject to numerical precision and round-off error)
the two colors will look the same and represent the same color sensation.

<div algorithm>
To <dfn export>prepare a color |col1| for conversion</dfn>:

<ol>
	<li id="powerless-to-missing">Change any [=powerless component=]s in |src| to [=missing component=]s</li>
	<li id="convert-polrect">If |src| is in a <a>cylindrical polar color</a> representation,
	convert |col1|
	to the corresponding <a>rectangular orthogonal color</a> representation
	and let this be the new |col1|.
</ol>
</div>

<div algorithm>
To <dfn export>convert a color</dfn> |col1| in a source color space |src|
with white point |src-white|
to a color |col2| in destination color space |dest|
with white point |dest-white|,
where |src| and |dest| are <em>different</em>:

<ol>
	<li>prepare |col1| for conversion</li>

	<li id="convert-missing">Replace any [=missing component=] with zero.</li>

	<li id="convert-tolinear">If |src| is not a linear-light representation,
	convert it to linear light (undo gamma-encoding)
	and let this be the new |col1|.

	<li id="convert-toXYZ">Convert |col1| to CIE XYZ with a given whitepoint |src-white|
	and let this be |xyz|.

	<li id="convert-CAT">If |dest-white| is not the same as |src-white|,
	chromatically adapt |xyz| to |dest-white|
	using a linear Bradford [=chromatic adaptation transform=],
	and let this be the new |xyz|.

	<li id="convert-destpolar">If |dest| is a <a>cylindrical polar color</a> representation,
	let |dest-rect| be the corresponding  <a>rectangular orthogonal color</a> representation.
	Otherwise, let |dest-rect| be |dest|.

	<li id="convert-fromXYZ">Convert |xyz| to |dest|,
	followed by applying any transfer function (gamma encoding),
	producing |col2|.

	<li id="convert-display">If |dest| is a physical output color space, such as a display,
	then |col2| must be [=css gamut mapped=]
	so that it [=can be displayed=].

	<!-- unbounded hsl
	<li id="convert-hslhwb">If |dest| cannot represent [=out of gamut=] colors,
	for example ''hsl'' or ''hwb'',
	then |col2| must be [=css gamut mapped=]. -->

	<li id="convert-rectpol">If |dest-rect| is not the same as |dest|,
	in other words |dest| is a <a>cylindrical polar color</a> representation,
	convert from |dest-rect| to |dest|, and let this be |col2|.
	This may produce [=missing component=]s.
</ol>
</div>


<!--
 ██████   ███████  ██     ██ ████████     ███    ████████  ████████
██    ██ ██     ██ ███   ███ ██          ██ ██   ██     ██ ██
██       ██     ██ ████ ████ ██         ██   ██  ██     ██ ██
██       ██     ██ ██ ███ ██ ██████    ██     ██ ████████  ██████
██       ██     ██ ██     ██ ██        █████████ ██   ██   ██
██    ██ ██     ██ ██     ██ ██        ██     ██ ██    ██  ██
 ██████   ███████  ██     ██ ████████  ██     ██ ██     ██ ████████
-->

<h2 id="comparing-color-values">
Comparing <<color>> Values</h2>

	Two <<color>> values are <dfn export>equivalent colors</dfn>
	when they compare as equal using the algorithm below.
	This comparison is used,
	for example,
	by ''style()'' container queries [[CSS-CONDITIONAL-5]]
	and by CSS Transitions [[CSS-TRANSITIONS-1]]
	to determine whether a color value has changed.

	Given two <<color>> values <var>C1</var> and <var>C2</var>,
	they are [=equivalent colors=] if and only if
	the following algorithm returns true:

	<ol>
		<li>
			For each of <var>C1</var> and <var>C2</var>,
			convert any [=powerless component=]s to [=missing component=]s.
		</li>
		<li>
			If <var>C1</var> and <var>C2</var> share the same <<color-space>>:
			<ol>
				<li>
					Compare their components one by one,
					including the alpha channel.
					A [=missing component=] is only equal to
					another [=missing component=].
					Two numeric components are considered equal
					if they differ by no more than a small
					implementation-defined ε.
				</li>
				<li>
					Return true if and only if
					all components compare as equal.
				</li>
			</ol>
		</li>
		<li>
			Otherwise, <var>C1</var> and <var>C2</var> are in different <<color-space>>s.
			If either color has at least one [=missing component=],
			return false.
		</li>
		<li>
			Otherwise, neither color has any [=missing component=].
			Convert both <var>C1</var> and <var>C2</var> to ''oklab'',
			then return true if and only if
			all components (including alpha) of the converted colors
			compare as equal,
			using a standardized Oklab ε of <strong>0.00001</strong>.
		</li>
	</ol>

	Note: Two colors that are expressed in different <<color-space>>s
	but are colorimetrically identical—for example,
	''red'' and ''color(srgb 1 0 0)''—are [=equivalent colors=]
	by step 4 of this algorithm,
	since they convert to the same ''oklab'' value.

	For the purposes of this comparison,
	''rgb()'', ''rgba()'', ''hsl()'', ''hsla()'', ''hwb()'',
	[=hex colors=], [=named colors=], and [=system colors=]
	are all considered to be in the ''srgb'' <<color-space>>.

<wpt pathprefix="/css/css-conditional/container-queries/">
	query-style-color.html
</wpt>


<!--
████ ██    ██ ████████ ████████ ████████  ████████   ███████  ██          ███    ████████ ████████
 ██  ███   ██    ██    ██       ██     ██ ██     ██ ██     ██ ██         ██ ██      ██    ██
 ██  ████  ██    ██    ██       ██     ██ ██     ██ ██     ██ ██        ██   ██     ██    ██
 ██  ██ ██ ██    ██    ██████   ████████  ████████  ██     ██ ██       ██     ██    ██    ██████
 ██  ██  ████    ██    ██       ██   ██   ██        ██     ██ ██       █████████    ██    ██
 ██  ██   ███    ██    ██       ██    ██  ██        ██     ██ ██       ██     ██    ██    ██
████ ██    ██    ██    ████████ ██     ██ ██         ███████  ████████ ██     ██    ██    ████████
-->

<h2 id="interpolation">
Color Interpolation</h2>

	Color interpolation happens with
	gradients,
	compositing,
	filters,
	transitions,
	animations, and
	color mixing and color modification functions.

	Interpolation between two <<color>> values
	takes place by executing the following steps:

	<ol>
		<li>checking the two colors for [=analogous components=]
			and [=analogous set|analogous sets=]
			which will be <dfn export>carried forward</dfn></li>
		<li>changing any [=powerless=] components to [=missing=] values
		</li>
		<li>converting them both to a given color space
			which will be referred to as the <dfn export>interpolation color space</dfn> below.
		</li>
		<li>(if required) re-inserting [=carried forward=] values in the converted colors</li>
		<li>(if required) fixing up the hues, depending on the selected <<hue-interpolation-method>></li>
		<li>changing the color components to [=premultiplied=] form</li>
		<li>linearly interpolating each component of the computed value of the color separately</li>
		<li>undoing [=premultiplied|premultiplication=]</li>
	</ol>


<!--

	Historically the existing specifications used interpolation in gamma-encoded sRGB.
	This gave poor results, and was sRGB-only.
	This specification improves the situation by

	- using a perceptually uniform interpolation space by default
	- enabling interpolation between any color
	  (which has a colorimetric interpretation, which is all of them except for device-cmyk and even then, only in corner cases)
	- allowing individual specifications to override this
	  (for example compositing should be in linear-light XYZ)
	  (for example, color-mix defaults to LCH but allows other spaced to be explicitly specified)
	- maintaining Web compat with special-case where all the colors to be interpolated use legacy sRGB
	- providing an opt-in for sRGB colors

	The legacy specifications will over time be updated to add support for non-sRGB colors

	This is all in a comment because we don't make promises about future specifications

	But rest assured, they are all being targeted.

-->

	Interpolating to or from ''<color>/currentcolor'' is possible.
	The numerical value used for this purpose is the used value.


<h3 id="interpolation-space">
Color Space for Interpolation</h3>

	Various features in CSS depend on interpolating colors.

	<div class="example" id="ex-interpolating-specs">
	Examples include:

		* <<gradient>>
		* 'filter'
		* 'animation'
		* 'transition'
		* ''color-mix()''
		* [=relative color=] syntax
	</div>

	Mixing or otherwise combining colors
	has different results depending on the [=interpolation color space=] used.
	Thus, different color spaces may be more appropriate for each interpolation use case.

	* In some cases, the result of physically mixing two colored lights is desired.
		In that case, the CIE ''XYZ'', ''display-p3-linear''  or ''srgb-linear'' color spaces are appropriate, because they are linear in light intensity.
	* If colors need to be evenly spaced perceptually (such as in a gradient),
		the ''Oklab'' color space (and the older ''Lab''), are designed to be perceptually uniform.
	* If avoiding graying out in color mixing is desired, i.e. maximizing chroma throughout the transition,
		''OkLCh'' (and the older ''LCH'') work well for that.
	* Lastly, compatibility with legacy Web content may be the most important consideration.
		The ''sRGB'' color space, which is neither linear-light nor perceptually uniform, is the choice here,
		even though it produces poorer results (overly dark or greyish mixes).

	These features are collectively termed the <dfn export>host syntax</dfn>.

	To permit a host syntax to indicate the [=interpolation color space=],
	this specification exports a
	<a href="#color-interpolation-method">color-interpolation-method</a> production.
	It is not used by this specification itself,
	only exposed so that other specifications can use it;
	<span class="non-normative">see e.g. use in [[css-images-4#linear-gradients]].</span>

	The host syntax should define
	what the <em>default</em> [=interpolation color space=]  should be for each case,
	and preferably provide syntax for authors to override this default.
	If such syntax is part of a property value, it should use the
	<a href="#color-interpolation-method">color-interpolation-method</a> production,
	defined below for easy reference from other specifications.
	This ensures consistency across CSS,
	and that further customizations on how color interpolation is performed
	can automatically percolate across all of CSS.

	<pre class='prod'>
		<dfn export>&lt;color-space></dfn> = &lt;rectangular-color-space> | &lt;polar-color-space>
		<dfn export>&lt;rectangular-color-space></dfn> = <l>''srgb''</l> | <l>''srgb-linear''</l> | <l>''display-p3''</l> | <l>''display-p3-linear''</l> | <l>''a98-rgb''</l> | <l>''prophoto-rgb''</l> | <l>''rec2020''</l> | <l>''lab''</l> | <l>''oklab''</l> | <<xyz-space>>
		<dfn export>&lt;polar-color-space></dfn> = <l>''hsl''</l> | <l>''hwb''</l> | <l>''lch''</l> | <l>''oklch''</l>
		<dfn export>&lt;hue-interpolation-method></dfn> = [ shorter | longer | increasing | decreasing ] hue
		<dfn export id="color-interpolation-method">&lt;color-interpolation-method></dfn> = in [ <<rectangular-color-space>> | <<polar-color-space>> <<hue-interpolation-method>>? ]
	</pre>

	<p dfn-type=value dfn-for="<color-space>">
		The keywords in the definitions of <<rectangular-color-space>> and <<polar-color-space>>
		each refer to their corresponding color space,
		represented in CSS either by the functional syntax with the same name,
		or (if no such function is present), by the corresponding <<ident>> in the ''color()'' function.
	</p>

	<wpt>
		color-mix-percents-01.html
		color-mix-percents-02.html
	</wpt>

	<wpt pathprefix="css/css-images/">
		gradients-with-transparent.html
		gradient/gradient-eval-001.html
		gradient/gradient-eval-002.html
		gradient/gradient-eval-003.html
		gradient/gradient-eval-004.html
		gradient/gradient-eval-005.html
		gradient/gradient-eval-006.html
		gradient/gradient-eval-007.html
		gradient/gradient-eval-008.html
		gradient/gradient-eval-009.html
		gradient/gradient-none-interpolation.html
		gradient/oklab-gradient.html
		gradient/srgb-gradient.html
		gradient/srgb-linear-gradient.html
		gradient/xyz-gradient.html
		parsing/gradient-interpolation-method-valid.html
		parsing/gradient-interpolation-method-invalid.html
		parsing/gradient-interpolation-method-computed.html
	</wpt>

	If the host syntax does not define what color space
	interpolation should take place in,
	it defaults to Oklab.

	For a <<polar-color-space>> 
	if the <<hue-interpolation-method>> is not specified,
	it defaults to [=shorter=].

	However, user agents <em>must</em> handle interpolation
	between legacy sRGB color formats
	(hex colors, named colors,
	''rgb()'', ''hsl()'' or ''hwb()''
	and the equivalent alpha-including forms)
	in gamma-encoded sRGB space.
	This provides Web compatibility;
	legacy sRGB content interpolates in the sRGB space by default.

	<wpt  pathprefix="css/css-images/">
		gradient/legacy-color-gradient.html
	</wpt>

	This also means that authors can choose
	to opt-in to better interpolation,
	even between sRGB colors,
	by using the non-legacy ''color(srgb r g b)'' form
	for at least one of their colors,
	or by explicitly specifying an [=interpolation color space=].

	<wpt>
		/css/css-images/gradient/css-color-4-colors-default-to-oklab-gradient.html
	</wpt>

	<!-- Authors that prefer interpolation in sRGB
	in a particular instance
	can opt-in to the old behavior
	by explicitly specifying sRGB as the [=interpolation color space=],
	for example on a particular gradient where that result is desired. -->

	If the colors to be interpolated are outside the gamut
	of the [=interpolation color space=] ,
	then once converted to that space,
	they will contain out of range values.

	These are not clipped; the values must be interpolated as-is.

<h3 id="interpolation-missing">
Interpolating with Missing Components</h3>

	In the course of converting the two colors
	to the [=interpolation color space=],
	any [=missing components=]
	would be replaced with the value 0.

	Thus, the first stage in interpolating two colors
	is to classify any [=missing components=]
	in the input colors,
	and compare them to the components of the
	[=interpolation color space=].
	If any [=analogous components=] which are [=missing components=] are found,
	they will be <strong>carried forward</strong>
	and re-inserted in the converted color
	before premultiplication, and
	before linear interpolation takes place.

	Similarly, if every component of an [=analogous set=]
	(defined below)
	in the original color
	is a [=missing component=],
	they are all [=carried forward=]
	and re-inserted
	in the corresponding [=analogous set=]
	of the [=interpolation color space=].

	Alpha is its own analogous component
	(alpha is analogous to alpha),
	so a [=missing component|missing=] alpha
	is [=carried forward=] in exactly the same way
	as any other [=missing component=].

	The <dfn export>analogous components</dfn>  are as follows:

	<table>
		<tr>
			<th>Category</th>
			<th>Components</th>
		</tr>
		<tr>
			<td>Reds</td>
			<td>r,x</td>
		</tr>
		<tr>
			<td>Greens</td>
			<td>g,y</td>
		</tr>
		<tr>
			<td>Blues</td>
			<td>b,z</td>
		</tr>
		<tr>
			<td>Lightness</td>
			<td>L</td>
		</tr>
		<tr>
			<td>Colorfulness</td>
			<td>C, S</td>
		</tr>
		<tr>
			<td>Hue</td>
			<td>H</td>
		</tr>
		<tr>
			<td>Opponent a</td>
			<td>a</td>
		</tr>
		<tr>
			<td>Opponent b</td>
			<td>b</td>
		</tr>
		<tr>
			<td>Alpha</td>
			<td>alpha</td>
		</tr>
	</table>

	Note: for the purposes of this classification,
	the XYZ spaces are considered super-saturated RGB spaces.
	Also, despite Saturation being Lightness-dependent,
	it falls in the same category as Chroma here.
	The Whiteness and Blackness components of HWB
	have no analogs in other color spaces.

	Additionally, for any two color spaces,
	the components that remain
	after removing all [=analogous components=]
	form an <dfn export>analogous set</dfn> of components.

	Note: Because the full set of all color components
	is the [=analogous set=] that remains
	when there are no individual [=analogous components=],
	a color with all color components [=missing=]
	will have all color components [=missing=]
	in the [=interpolation color space=] as well.

	<div class="example" id="ex-analogous-set">
		When converting
		<code class="lang-css">lab(50% none none)</code> to LCH
		for interpolation,
		Lightness is individually [=analogous components|analogous=].
		The remaining components
		(''a'' and ''b'' in Lab; ''C'' and ''H'' in LCH)
		form an [=analogous set=].
		Since both ''a'' and ''b'' are [=missing=],
		both ''C'' and ''H'' are carried forward as [=missing=],
		giving <code class="lang-css">lch(50% none none)</code>
		rather than <code class="lang-css">lch(50% 0 0)</code>.

		Similarly,
		<code class="lang-css">rgb(none none none / 50%)</code>
		converted to OKLab for interpolation
		yields <code class="lang-css">oklab(none none none / 50%)</code>,
		because the three color components
		form the [=analogous set=]
		(there are no individual [=analogous components=]
		between sRGB and OKLab).
	</div>

	<wpt pathprefix="css/css-images/">
		gradient/gradient-none-interpolation.html
	</wpt>

	<div class="example" id="ex-analogous-hue">
		For example, if these two colors
		are to be interpolated in OkLCh,
		the missing hue in the CIE LCH color
		is analogous to the hue component of OkLCh
		and will be carried forward
		while the missing blue component
		in the second color
		is not analogous to any OkLCh component
		and will not be carried forward:

		<pre>
			<span class="swatch" style="--color: rgb(46.647% 46.628% 46.633%)"></span> lch(50% 0.02 none)
			<span class="swatch" style="--color: rgb(71.559% 49.813% 0%)"></span> color(display-p3 0.7 0.5 none)
		</pre>

		which convert to

		<pre>
			<span class="swatch" style="--color: rgb(46.647% 46.628% 46.633%)"></span> oklch(56.897% 0.0001 0)
			<span class="swatch" style="--color: rgb(71.559% 49.813% 0%)"></span> oklch(63.612% 0.1522 78.748)
		</pre>

		and with carried forward [=missing component=] re-inserted,
		the two colors to be interpolated are:

		<pre>
			<span class="swatch" style="--color: rgb(46.647% 46.628% 46.633%)"></span> oklch(56.897% 0.0001 none)
			<span class="swatch" style="--color: rgb(71.559% 49.813% 0%)"></span> oklch(63.612% 0.1522 78.748)
		</pre>
	</div>

	If a color with a carried forward [=missing component=]
	is interpolated
	with another color
	which is not missing that component,
	the [=missing component=]
	is treated as having
	the <em>other color's</em> component value.

	Therefore,
	the identification of carried-forward components
	must be performed <em>before</em> any
	[=powerless component=] handling;
	to prevent conversion of that value to zero.

	<div class="example" id="ex-oklch-missing-hue">
		For example, if these two colors are interpolated,
		the second of which has a missing hue:

		<pre>
			<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7%)"></span> oklch(78.3% 0.108 326.5)
			<span class="swatch" style="--color: rgb(48.4% 0% 22.8%)"></span> oklch(39.2% 0.4 none)
		</pre>

		Then the actual colors to be interpolated are

		<pre>
			<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7%)"></span> oklch(78.3% 0.108 326.5)
			<span class="swatch" style="--color: rgb(39% 0% 39.4%)"></span> oklch(39.2% 0.4 326.5)
		</pre>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(78.3%25%200.108%20326.5)&color2=oklch(39.2%25%200.4%20326.5) -->
		<div style="width: 100%; height: 5em; background: linear-gradient(to right, oklch(78.3% 0.108 326.5), oklch(73.956% 0.14044 326.5), oklch(69.611% 0.17289 326.5), oklch(65.267% 0.20533 326.5), oklch(60.922% 0.23778 326.5), oklch(56.578% 0.27022 326.5), oklch(52.233% 0.30267 326.5), oklch(47.889% 0.33511 326.5), oklch(43.544% 0.36756 326.5), oklch(39.2% 0.4 326.5))"></div>

		and not

		<pre>
			<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7%)"></span> oklch(78.3% 0.108 326.5)
			<span class="swatch" style="--color: rgb(48.4% 0% 22.8%)"></span> oklch(39.2% 0.4 0)
		</pre>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(78.3%25%200.108%20326.5)&color2=oklch(39.2%25%200.4%200) -->
		<div style="width: 100%; height: 5em; background: linear-gradient(to right, oklch(78.3% 0.108 326.5), oklch(75.507% 0.12886 328.89), oklch(72.714% 0.14971 331.29), oklch(69.921% 0.17057 333.68), oklch(67.129% 0.19143 336.07), oklch(64.336% 0.21229 338.46), oklch(61.543% 0.23314 340.86), oklch(58.75% 0.254 343.25), oklch(55.957% 0.27486 345.64), oklch(53.164% 0.29571 348.04), oklch(50.371% 0.31657 350.43), oklch(47.579% 0.33743 352.82), oklch(44.786% 0.35829 355.21), oklch(41.993% 0.37914 357.61), oklch(39.2% 0.4 360))"></div>
	</div>

	If the carried forward [=missing component=]
	is alpha, the color must be [=premultiplied=] with this carried forward value,
	not with the zero value that would have resulted from color conversion.

	<div class="example" id="ex-oklch-missing-alpha">
		For example, if these two colors are interpolated,
		the second of which has a missing alpha:

		<pre>
			<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7% / 0.5)"></span> oklch(0.783 0.108 326.5 / 0.5)
			<span class="swatch" style="--color: rgb(48.4% 0% 22.8% / 0)"></span> oklch(0.392 0.4 0 / none)
		</pre>

		Then the actual colors to be interpolated are

		<pre>
			<span class="swatch" style="--color: rgb(86.6% 62.7% 86.7% / 0.5)"></span> oklch(78.3% 0.108 326.5 / 0.5)
			<span class="swatch" style="--color: rgb(48.4% 0% 22.8% / 0.5)"></span> oklch(39.2% 0.4 0 / 0.5)
		</pre>

		giving the premultiplied OkLCh values [0.3915, 0.054, 326] and [0.196, 0.2, 0].

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(78.3%25%200.108%20326.5%20%2F%200.5)&color2=oklch(39.2%25%200.4%200%20%2F%200.5) -->
		<div style="width: 100%; height: 5em; background:linear-gradient(to right, oklch(78.3% 0.108 326.5 / 0.5), oklch(75.507% 0.12886 328.89 / 0.5), oklch(72.714% 0.14971 331.29 / 0.5), oklch(69.921% 0.17057 333.68 / 0.5), oklch(67.129% 0.19143 336.07 / 0.5), oklch(64.336% 0.21229 338.46 / 0.5), oklch(61.543% 0.23314 340.86 / 0.5), oklch(58.75% 0.254 343.25 / 0.5), oklch(55.957% 0.27486 345.64 / 0.5), oklch(53.164% 0.29571 348.04 / 0.5), oklch(50.371% 0.31657 350.43 / 0.5), oklch(47.579% 0.33743 352.82 / 0.5), oklch(44.786% 0.35829 355.21 / 0.5), oklch(41.993% 0.37914 357.61 / 0.5), oklch(39.2% 0.4 360 / 0.5))"></div>
	
	</div>

	If both colors are [=missing=]
	a given component,
	the interpolated color
	will also be [=missing=] that component.


<h3 id="interpolation-alpha">
Interpolating with Alpha</h3>

	When the colors to be interpolated are not fully opaque,
	they are first <dfn export>premultiplied</dfn>
	as follows:

	*  If the alpha value is ''none'', the premultiplied value is the un-premultiplied value. Otherwise,
	*  If any component value is ''none'', the premultiplied value is also ''none''.
	*  For [=rectangular orthogonal color=] coordinate systems, all component values are multiplied by the alpha value.
	*  For [=cylindrical polar color=] coordinate systems, the hue angle is <em>not</em> premultiplied, but the other two axes <em>are</em> premultiplied.

	To obtain a color value from a premultiplied color value,

	* If the interpolated alpha value is zero or ''none'',
		the un-premultiplied value is the premultiplied value. Otherwise,
	* If any component value is ''none'',
		the un-premultiplied value is also ''none''.
	* otherwise, each component which had been premultiplied
		is divided by the interpolated alpha value.

	<wpt pathprefix="css/css-transitions">
		animations/color-transition-premultiplied.html
	</wpt>


	<details class=note id=premultiplied-explainer>
		<summary>Why is premultiplied alpha useful?</summary>

		<!-- A “pre-multiplied” color
		is written in a form
		where the alpha component
		is multiplied into the color components,
		rather than being processed independently.
		For example, a partially-transparent blue may be given as <code class=lang-css><nobr>rgba(0, 0, 255, .5)</nobr></code>,
		which would then be expressed as <code><nobr>[0, 0, 127.5, .5]</nobr></code> in its premultiplied representation. -->

		Interpolating colors using the premultiplied representations
		tends to produce more attractive transitions than the non-premultiplied representations,
		particularly when transitioning from a fully opaque color to fully transparent.

		Note that transitions where either the transparency or the color are held constant
		(for example, transitioning between <code class=lang-css><nobr>rgba(255, 0, 0, 100%)</nobr></code> (opaque red)
		and <code class=lang-css><nobr>rgba(0,0,255,100%)</nobr></code> (opaque blue),
		or <code class=lang-css><nobr>rgba(255,0,0,100%)</nobr></code> (opaque red)
		and <code class=lang-css><nobr>rgba(255,0,0,0%)</nobr></code> (transparent red))
		have identical results whether the color interpolation is done in premultiplied or non-premultiplied color-space.
		Differences only arise when <em>both</em> the color and transparency differ between the two endpoints.

		<div class=example id="ex-gradient-transition-premultiply">
			The following example illustrates the difference between
			a gradient transitioning via pre-multiplied values
			(in this case sRGB, since all colors involved are legacy colors)
			and one transitioning (incorrectly) via non-premultiplied values.
			In both of these examples,
			the gradient is drawn over a white background.
			Both gradients could be written with the following value:

			<pre>linear-gradient(90deg, red, transparent, blue)</pre>

			With premultiplied colors,
			transitions to or from "transparent" always look nice:

			<object data="images/gradient2.svg" width="200" height="100">(Image requires SVG)</object>

			On the other hand,
			if a gradient were to incorrectly transition in non-premultiplied space,
			the center of the gradient would be a noticeably grayish color,
			because "transparent" is actually a shorthand for ''rgba(0,0,0,0)'', or transparent black,
			meaning that the red transitions to a black
			as it loses opacity,
			and similarly with the blue's transition:

			<object data="images/gradient3.svg" width="200" height="100">(Image requires SVG)</object>
		</div>

	</details>

	<div class="example" id="ex-premultiplied-srgb">
		For example, to interpolate, in the sRGB color space, the two sRGB colors
		<span class="swatch" style="--color: rgb(24%, 12%, 98%, 0.4)"></span> rgb(24% 12% 98% / 0.4)
		and
		<span class="swatch" style="--color: rgb(62% 26% 64% / 0.6)"></span> rgb(62% 26% 64% / 0.6)
		they would first be converted to premultiplied form
		[9.6% 4.8% 39.2% ]
		and
		[37.2% 15.6% 38.4%]
		before interpolation.

		The midpoint of linearly interpolating these colors
		would be [23.4% 10.2% 38.8%]
		which, with an alpha value of 0.5,
		is <span class="swatch" style="--color: rgb(46.8%, 21.4%, 77.6%, 0.5)"></span> rgb(46.8% 20.4% 77.6% / 0.5)
		when premultiplication is undone.
	</div>

	<div class="example" id="ex-premultiplied-lab">
		To interpolate, in the Lab color space, the two colors
		<span class="swatch" style="--color: rgb(76%, 62%, 03%, 0.4)"></span> rgb(76% 62% 03% / 0.4)
		and
		<span class="swatch" style="--color: rgb(91.56%, 3.87%, 74.09%, 0.6)"></span> color(display-p3 0.84 0.19 0.72 / 0.6)
		they are first converted to lab
		<span class="swatch" style="--color: rgb(76%, 62%, 03%, 0.4)"></span> lab(66.927% 4.873 68.622 / 0.4)
		<span class="swatch" style="--color: rgb(91.56%, 3.87%, 74.09%, 0.6)"></span> lab(53.503% 82.672 -33.901 / 0.6)
		then the L, a and b coordinates are premultiplied before interpolation
		[26.771% 1.949 27.449]
		and
		[32.102% 49.603 -20.341].

		The midpoint of linearly interpolating these would be
		[29.4365% 25.776 3.554]
		which, with an alpha value of 0.5,
		is <span class="swatch" style="--color: rgb(87.604%, 38.956%, 51.753%, 0.5)"></span> lab(58.873% 51.552 7.108) / 0.5)
		when premultiplication is undone.
	</div>

	<div class="example" id="ex-premultiplied-lch">
		To interpolate, in the chroma-preserving LCH color space, the same two colors
		<span class="swatch" style="--color: rgb(76%, 62%, 03%, 0.4)"></span> rgb(76% 62% 03% / 0.4)
		and
		<span class="swatch" style="--color: rgb(91.56%, 3.87%, 74.09%, 0.6)"></span> color(display-p3 0.84 0.19 0.72 / 0.6)
		they are first converted to LCH
		<span class="swatch" style="--color: rgb(76%, 62%, 03%, 0.4)"></span> lch(66.93% 68.79 85.94 / 0.4)
		<span class="swatch" style="--color: rgb(91.56%, 3.87%, 74.09%, 0.6)"></span> lch(53.5% 89.35 337.7 / 0.6)
		then the L and C coordinates (but not H) are premultiplied before interpolation
		[26.771% 27.516 85.94]
		and
		[32.102% 53.61 337.7].

		The midpoint of linearly interpolating these,
		along the ''shorter'' hue arc (the default) would be
		[29.4365% 40.563 31.82]
		which, with an alpha value of 0.5,
		is <span class="swatch" style="--color: rgb(99.344% 28.029% 28.277% / 0.5)"></span>  lch(58.873% 81.126 31.82) / 0.5)
		when premultiplication is undone.

	</div>

	There is sample JavaScript code
	for alpha premultiplication and un-premultiplication,
	for both polar and rectangular color spaces,
	in [[#color-conversion-code]].


<h3 id="hue-interpolation">
Hue Interpolation</h3>

	For color functions with a hue angle (LCH, HSL, HWB etc), there are multiple ways to interpolate.
	As arcs greater than 360&deg; are rarely desirable,
	hue angles are fixed up prior to interpolation
	so that per-component interpolation is done over less than 360&deg;, often less than 180&deg;.

	Host syntax can specify any of the following algorithms for hue interpolation
	(angles in the following are in degrees, but the logic is the same regardless of how they are specified).
	Specifying a hue interpolation strategy is already part of the <<color-interpolation-method>> syntax
	via the <<hue-interpolation-method>> token.

	Unless otherwise specified, if no specific hue interpolation algorithm is selected by the host syntax, the default is ''shorter''.

	<wpt>
		color-mix-percents-01.html
		color-mix-percents-02.html
	</wpt>

	Note: As a reminder,
	if the interpolating colors were not already in the specified interpolation color space,
	then converting them will turn any [=powerless components=] into [=missing components=].

<h4 id="hue-shorter">
<dfn export>shorter</dfn></h4>

	Hue angles are interpolated to take the <em>shorter</em> of the two arcs
	between the starting and ending hues.

	<div class="example" id="ex-shorter">
		<p>For example, the midpoint when interpolating in OkLCh from a red
		<span class="swatch" style="--color: rgb(93.22% 7.98% 0.485%)"></span>&nbsp;oklch(0.6 0.24 30) to a yellow
		<span class="swatch" style="--color: rgb(89.07% 72.28% 19.23%)"></span>&nbsp;oklch(0.8 0.15 90)
		would be at a hue angle of 30 + (90 - 30) * 0.5 = 60 degrees,
		along the shorter arc between the two colors,
		giving a deep orange
		<span class="swatch" style="--color: rgb(87.66% 51.96% 0%)"></span>&nbsp;oklch(0.7 0.195 60)</p>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(0.6%200.24%2030)%20&color2=%20oklch(0.8%200.15%2090) -->

		<div style="width: 100%; height: 5em; background: linear-gradient(to right, color(display-p3 0.85564 0.2067 0.1305), color(display-p3 0.86525 0.25647 0.08503), color(display-p3 0.87307 0.30184 0.01956), color(display-p3 0.87915 0.34443 0), color(display-p3 0.88358 0.38509 0), color(display-p3 0.88645 0.42424 0), color(display-p3 0.88787 0.46214 0), color(display-p3 0.88795 0.49895 0), color(display-p3 0.88682 0.53474 0), color(display-p3 0.88463 0.56955 0.00893), color(display-p3 0.88154 0.60342 0.09436), color(display-p3 0.87773 0.63633 0.15435), color(display-p3 0.87339 0.66828 0.20709), color(display-p3 0.86872 0.69925 0.25696), color(display-p3 0.86396 0.72924 0.30547))"></div>
	</div>

	Angles are adjusted so that |θ₂ - θ₁| ∈ [-180, 180]. In pseudo-Javascript:
		<pre>
		if (θ₂ - θ₁ > 180) {
			θ₁ += 360;
		}
		else if (θ₂ - θ₁ < -180) {
			θ₂ += 360;
		}
		</pre>

<h4 id="hue-longer">
<dfn export>longer</dfn></h4>

	Hue angles are interpolated to take the <em>longer</em> of the two arcs
	between the starting and ending hues.

	<div class="example" id="ex-longer">
		<p>For example, the midpoint when interpolating in OkLCh from a red
		<span class="swatch" style="--color: rgb(93.22% 7.98% 0.485%)"></span>&nbsp;oklch(0.6 0.24 30) to a yellow
		<span class="swatch" style="--color: rgb(89.07% 72.28% 19.23%)"></span>&nbsp;oklch(0.8 0.15 90)
		would be at a hue angle of (30 + 360 + 90) * 0.5 = 240 degrees,
		along the longer arc between the two colors,
		giving a sky blue
		<span class="swatch" style="--color: rgb(0% 66.25% 100%)"></span>&nbsp;oklch(0.7 0.195 240)</p>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(0.6%200.24%2030)%20&color2=%20oklch(0.8%200.15%2090) -->
	
		<div style="width: 100%; height: 5em; background:linear-gradient(to right, color(display-p3 0.85564 0.2067 0.1305), color(display-p3 0.85667 0.20594 0.15629), color(display-p3 0.85754 0.20544 0.17925), color(display-p3 0.85825 0.2052 0.2003), color(display-p3 0.8588 0.2052 0.21997), color(display-p3 0.8592 0.20546 0.23859), color(display-p3 0.85944 0.20595 0.25639), color(display-p3 0.85953 0.20669 0.27354), color(display-p3 0.85946 0.20765 0.29014), color(display-p3 0.85924 0.20884 0.3063), color(display-p3 0.85887 0.21024 0.32207), color(display-p3 0.85835 0.21184 0.33752), color(display-p3 0.85768 0.21364 0.35269), color(display-p3 0.85686 0.21562 0.36761), color(display-p3 0.8559 0.21778 0.38231), color(display-p3 0.85478 0.2201 0.39681), color(display-p3 0.85353 0.22257 0.41114), color(display-p3 0.85213 0.22518 0.4253), color(display-p3 0.85059 0.22793 0.43932), color(display-p3 0.84891 0.23081 0.4532), color(display-p3 0.84708 0.23379 0.46694), color(display-p3 0.84512 0.23689 0.48057), color(display-p3 0.84303 0.24008 0.49407), color(display-p3 0.84079 0.24336 0.50746), color(display-p3 0.83843 0.24672 0.52075), color(display-p3 0.83593 0.25016 0.53392), color(display-p3 0.83329 0.25366 0.54698), color(display-p3 0.83053 0.25723 0.55994), color(display-p3 0.82764 0.26086 0.57279), color(display-p3 0.82462 0.26454 0.58554), color(display-p3 0.82148 0.26826 0.59818), color(display-p3 0.81821 0.27203 0.61071), color(display-p3 0.81482 0.27584 0.62313), color(display-p3 0.8113 0.27969 0.63543), color(display-p3 0.80767 0.28357 0.64763), color(display-p3 0.80391 0.28748 0.6597), color(display-p3 0.80004 0.29142 0.67166), color(display-p3 0.79605 0.29539 0.68349), color(display-p3 0.79195 0.29938 0.6952), color(display-p3 0.78773 0.3034 0.70677), color(display-p3 0.7834 0.30744 0.71822), color(display-p3 0.77895 0.31151 0.72953), color(display-p3 0.7744 0.31559 0.7407), color(display-p3 0.76973 0.3197 0.75173), color(display-p3 0.76496 0.32383 0.76261), color(display-p3 0.76008 0.32798 0.77334), color(display-p3 0.75509 0.33215 0.78391), color(display-p3 0.75 0.33634 0.79433), color(display-p3 0.74481 0.34056 0.80459), color(display-p3 0.73951 0.34479 0.81468), color(display-p3 0.73411 0.34905 0.8246), color(display-p3 0.7286 0.35334 0.83435), color(display-p3 0.723 0.35764 0.84392), color(display-p3 0.71729 0.36198 0.85331), color(display-p3 0.71149 0.36633 0.86252), color(display-p3 0.70558 0.37072 0.87154), color(display-p3 0.69958 0.37513 0.88037), color(display-p3 0.69348 0.37956 0.88901), color(display-p3 0.68728 0.38403 0.89745), color(display-p3 0.68098 0.38852 0.90568), color(display-p3 0.67459 0.39304 0.91371), color(display-p3 0.6681 0.39759 0.92154), color(display-p3 0.66151 0.40217 0.92915), color(display-p3 0.65483 0.40678 0.93655), color(display-p3 0.64805 0.41142 0.94374), color(display-p3 0.64117 0.41609 0.95071), color(display-p3 0.6342 0.42079 0.95745), color(display-p3 0.62713 0.42552 0.96397), color(display-p3 0.61996 0.43029 0.97026), color(display-p3 0.61269 0.43508 0.97633), color(display-p3 0.60533 0.4399 0.98216), color(display-p3 0.59786 0.44475 0.98777), color(display-p3 0.5903 0.44962 0.99313), color(display-p3 0.58263 0.45453 0.99827), color(display-p3 0.57486 0.45946 1), color(display-p3 0.56699 0.46442 1), color(display-p3 0.55901 0.46941 1), color(display-p3 0.55093 0.47441 1), color(display-p3 0.54274 0.47945 1), color(display-p3 0.53444 0.4845 1), color(display-p3 0.52603 0.48958 1), color(display-p3 0.51751 0.49467 1), color(display-p3 0.50886 0.49978 1), color(display-p3 0.50011 0.50491 1), color(display-p3 0.49122 0.51005 1), color(display-p3 0.48222 0.5152 1), color(display-p3 0.47308 0.52037 1), color(display-p3 0.46381 0.52554 1), color(display-p3 0.45441 0.53072 1), color(display-p3 0.44486 0.53591 1), color(display-p3 0.43517 0.5411 1), color(display-p3 0.42532 0.54629 1), color(display-p3 0.41532 0.55147 1), color(display-p3 0.40514 0.55666 1), color(display-p3 0.39479 0.56184 1), color(display-p3 0.38426 0.56701 1), color(display-p3 0.37352 0.57217 1), color(display-p3 0.36258 0.57731 1), color(display-p3 0.35142 0.58245 1), color(display-p3 0.34002 0.58756 1), color(display-p3 0.32836 0.59266 1), color(display-p3 0.31642 0.59773 1), color(display-p3 0.30418 0.60278 1), color(display-p3 0.2916 0.60781 1), color(display-p3 0.27864 0.6128 1), color(display-p3 0.26526 0.61777 1), color(display-p3 0.2514 0.6227 1), color(display-p3 0.237 0.62759 1), color(display-p3 0.22194 0.63245 1), color(display-p3 0.20612 0.63727 1), color(display-p3 0.18935 0.64204 1), color(display-p3 0.17139 0.64678 1), color(display-p3 0.15187 0.65146 1), color(display-p3 0.13019 0.6561 1), color(display-p3 0.10523 0.66069 1), color(display-p3 0.07454 0.66522 0.99755), color(display-p3 0.03037 0.6697 0.99279), color(display-p3 0 0.67412 0.98785), color(display-p3 0 0.67849 0.98273), color(display-p3 0 0.6828 0.97743), color(display-p3 0 0.68704 0.97197), color(display-p3 0 0.69122 0.96634), color(display-p3 0 0.69534 0.96054), color(display-p3 0 0.69939 0.95458), color(display-p3 0 0.70337 0.94847), color(display-p3 0 0.70728 0.94221), color(display-p3 0 0.71112 0.93581), color(display-p3 0 0.71489 0.92925), color(display-p3 0 0.71859 0.92257), color(display-p3 0 0.72221 0.91574), color(display-p3 0 0.72576 0.90879), color(display-p3 0 0.72923 0.90171), color(display-p3 0 0.73262 0.89451), color(display-p3 0 0.73593 0.88719), color(display-p3 0 0.73916 0.87975), color(display-p3 0 0.74231 0.87221), color(display-p3 0 0.74538 0.86457), color(display-p3 0 0.74837 0.85682), color(display-p3 0 0.75127 0.84898), color(display-p3 0 0.75409 0.84105), color(display-p3 0 0.75683 0.83303), color(display-p3 0 0.75948 0.82492), color(display-p3 0 0.76204 0.81674), color(display-p3 0 0.76452 0.80848), color(display-p3 0 0.76692 0.80016), color(display-p3 0 0.76922 0.79176), color(display-p3 0 0.77144 0.78331), color(display-p3 0 0.77358 0.7748), color(display-p3 0 0.77562 0.76623), color(display-p3 0 0.77758 0.75762), color(display-p3 0 0.77945 0.74896), color(display-p3 0 0.78124 0.74025), color(display-p3 0 0.78294 0.73152), color(display-p3 0 0.78455 0.72274), color(display-p3 0 0.78607 0.71394), color(display-p3 0.02324 0.78751 0.70512), color(display-p3 0.07355 0.78886 0.69627), color(display-p3 0.10755 0.79012 0.6874), color(display-p3 0.13486 0.7913 0.67853), color(display-p3 0.15854 0.79239 0.66964), color(display-p3 0.17986 0.7934 0.66074), color(display-p3 0.19954 0.79433 0.65185), color(display-p3 0.21797 0.79517 0.64295), color(display-p3 0.23542 0.79593 0.63406), color(display-p3 0.2521 0.7966 0.62518), color(display-p3 0.26812 0.79719 0.61632), color(display-p3 0.2836 0.7977 0.60747), color(display-p3 0.2986 0.79814 0.59864), color(display-p3 0.31319 0.79849 0.58983), color(display-p3 0.32742 0.79876 0.58105), color(display-p3 0.34132 0.79895 0.5723), color(display-p3 0.35492 0.79907 0.56359), color(display-p3 0.36826 0.79911 0.55492), color(display-p3 0.38136 0.79907 0.54629), color(display-p3 0.39423 0.79896 0.53771), color(display-p3 0.40688 0.79878 0.52918), color(display-p3 0.41934 0.79852 0.5207), color(display-p3 0.43162 0.7982 0.51228), color(display-p3 0.44372 0.7978 0.50393), color(display-p3 0.45565 0.79733 0.49565), color(display-p3 0.46742 0.7968 0.48743), color(display-p3 0.47904 0.7962 0.4793), color(display-p3 0.49051 0.79554 0.47124), color(display-p3 0.50184 0.79481 0.46327), color(display-p3 0.51303 0.79401 0.4554), color(display-p3 0.52409 0.79316 0.44762), color(display-p3 0.53502 0.79225 0.43994), color(display-p3 0.54582 0.79127 0.43238), color(display-p3 0.55649 0.79024 0.42492), color(display-p3 0.56704 0.78916 0.41759), color(display-p3 0.57747 0.78802 0.41039), color(display-p3 0.58778 0.78682 0.40333), color(display-p3 0.59797 0.78558 0.3964), color(display-p3 0.60805 0.78429 0.38963), color(display-p3 0.61801 0.78295 0.38301), color(display-p3 0.62785 0.78156 0.37657), color(display-p3 0.63758 0.78013 0.3703), color(display-p3 0.6472 0.77865 0.36421), color(display-p3 0.6567 0.77713 0.35832), color(display-p3 0.66609 0.77558 0.35263), color(display-p3 0.67537 0.77398 0.34716), color(display-p3 0.68454 0.77235 0.34192), color(display-p3 0.69359 0.77068 0.33691), color(display-p3 0.70253 0.76899 0.33215), color(display-p3 0.71136 0.76726 0.32764), color(display-p3 0.72008 0.7655 0.32341), color(display-p3 0.72869 0.76372 0.31946), color(display-p3 0.73718 0.76191 0.3158), color(display-p3 0.74556 0.76007 0.31244), color(display-p3 0.75382 0.75822 0.30939), color(display-p3 0.76198 0.75635 0.30667), color(display-p3 0.77001 0.75446 0.30427), color(display-p3 0.77794 0.75255 0.30222), color(display-p3 0.78575 0.75063 0.30051), color(display-p3 0.79344 0.7487 0.29915), color(display-p3 0.80102 0.74676 0.29816), color(display-p3 0.80849 0.74482 0.29752), color(display-p3 0.81583 0.74287 0.29725), color(display-p3 0.82306 0.74091 0.29734), color(display-p3 0.83017 0.73896 0.2978), color(display-p3 0.83717 0.737 0.29862), color(display-p3 0.84405 0.73505 0.29981), color(display-p3 0.8508 0.7331 0.30135), color(display-p3 0.85744 0.73117 0.30324), color(display-p3 0.86396 0.72924 0.30547))"></div>
	
	</div>

	Angles are adjusted so that |θ₂ - θ₁| ∈ {(-360, -180], [180, 360)}. In pseudo-Javascript:
		<pre>
		if (0 < θ₂ - θ₁ < 180) {
			θ₁ += 360;
		}
		else if (-180 < θ₂ - θ₁ <= 0) {
			θ₂ += 360;
		}
		</pre>

<h4 id="hue-increasing">
<dfn export>increasing</dfn></h4>

	Hue angles are interpolated so that,
	as they progress from the first color to the second,
	the angle is always <em>increasing</em>.
	If the angle increases to 360 it is reset to zero,
	and then continues increasing.

	Depending on the difference between the two angles,
	this will either look the same as <em>shorter</em> or as <em>longer.</em>
	However, if one of the hue angles is being animated,
	and the hue angle difference passes through 180 degrees,
	the interpolation will not flip to the other arc.

	<div class="example" id="ex-increasing">
		<p>For example, the midpoint when interpolating in OkLCh from a deep brown
		<span class="swatch" style="--color: rgb(57.92% 29.44% 25.11%)"></span>&nbsp;oklch(0.5 0.1 30) to a turquoise
		<span class="swatch" style="--color: rgb(26.29% 69.89% 67.49%)"></span>&nbsp;oklch(0.7 0.1 190)
		would be at a hue angle of (30 + 190) * 0.5 = 110 degrees,
		giving a khaki
		<span class="swatch" style="--color: rgb(51.73% 52.26% 22.03%)"></span>&nbsp;oklch(0.6 0.1 110).</p>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(0.5%200.1%2030)&color2=oklch(0.7%200.1%20190)%20 -->

		<div style="width: 100%; height: 5em; background: linear-gradient(to right, color(display-p3 0.54199 0.30934 0.26448), color(display-p3 0.55468 0.33447 0.23887), color(display-p3 0.56187 0.36244 0.21736), color(display-p3 0.56349 0.39269 0.20288), color(display-p3 0.55963 0.42453 0.19879), color(display-p3 0.55051 0.45724 0.20779), color(display-p3 0.53651 0.4901 0.23046), color(display-p3 0.51821 0.52242 0.26531), color(display-p3 0.49644 0.55355 0.30991), color(display-p3 0.47232 0.58292 0.36193), color(display-p3 0.44742 0.61005 0.41942), color(display-p3 0.4238 0.63453 0.48072), color(display-p3 0.40417 0.65606 0.54429), color(display-p3 0.39164 0.67448 0.60863), color(display-p3 0.3893 0.68974 0.67222))"></div>

		<p>However, if the hue of the second color is animated to
		<span class="swatch" style="--color: rgb(33.09% 66.63% 81.81%)"></span>&nbsp;oklch(0.7 0.1 230),
		the midpoint of the interpolation will be (30 + 230) * 0.5 = 130 degrees,
		continuing in the same increasing direction,
		giving another green
		<span class="swatch" style="--color: rgb(42.44% 54.95% 28.93%)"></span>&nbsp;oklch(0.6 0.1 130)
		rather than flipping to the opponent color part-way through the animation.</p>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(0.5%200.1%2030)&color2=oklch(0.7%200.1%20230) -->

		<div style="width: 100%; height: 5em; background: linear-gradient(to right, color(display-p3 0.54199 0.30934 0.26448), color(display-p3 0.54838 0.32269 0.2462), color(display-p3 0.55265 0.3372 0.22912), color(display-p3 0.55477 0.35276 0.2138), color(display-p3 0.55473 0.36922 0.20096), color(display-p3 0.55255 0.38642 0.19142), color(display-p3 0.54827 0.40419 0.18607), color(display-p3 0.54193 0.42235 0.18568), color(display-p3 0.53362 0.44072 0.19077), color(display-p3 0.52343 0.45911 0.20138), color(display-p3 0.51148 0.47737 0.21721), color(display-p3 0.49794 0.49532 0.23765), color(display-p3 0.48299 0.51282 0.26203), color(display-p3 0.46685 0.52972 0.28969), color(display-p3 0.44982 0.54588 0.32004), color(display-p3 0.43223 0.5612 0.3526), color(display-p3 0.41451 0.57556 0.38691), color(display-p3 0.39715 0.58887 0.42259), color(display-p3 0.38079 0.60107 0.45928), color(display-p3 0.36614 0.61209 0.4966), color(display-p3 0.35401 0.62189 0.53422), color(display-p3 0.34525 0.63046 0.57177), color(display-p3 0.34069 0.6378 0.60889), color(display-p3 0.34095 0.64393 0.64523), color(display-p3 0.34643 0.64888 0.68042), color(display-p3 0.35714 0.65272 0.71412), color(display-p3 0.3728 0.65554 0.74598), color(display-p3 0.39286 0.65743 0.77568), color(display-p3 0.41667 0.65849 0.80292))"></div>
	</div>

	Angles are adjusted so that |θ₂ - θ₁| ∈ [0, 360). In pseudo-Javascript:
		<pre>
		if (θ₂ < θ₁) {
			θ₂ += 360;
		}
		</pre>

<h4 id="hue-decreasing">
<dfn export>decreasing</dfn></h4>

	Hue angles are interpolated so that,
	as they progress from the first color to the second,
	the angle is always <em>decreasing</em>.
	If the angle decreases to 0 it is reset to 360,
	and then continues decreasing.

	Depending on the difference between the two angles,
	this will either look the same as <em>shorter</em> or as <em>longer.</em>
	However, if one of the hue angles is being animated,
	and the hue angle difference passes through 180 degrees,
	the interpolation will not flip to the other arc.

	<div class="example" id="ex-decreasing">
		<p>For example, the midpoint when interpolating in OkLCh from a deep brown
		<span class="swatch" style="--color: rgb(57.92% 29.44% 25.11%)"></span>&nbsp;oklch(0.5 0.1 30) to a turquoise
		<span class="swatch" style="--color: rgb(26.29% 69.89% 67.49%)"></span>&nbsp;oklch(0.7 0.1 190)
		would be at a hue angle of (30 + 360 + 190) * 0.5 = 290 degrees,
		giving a purple
		<span class="swatch" style="--color: rgb(49.98% 46.03% 72.08%)"></span>&nbsp;oklch(0.6 0.1 290).</p>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(0.5%200.1%2030)&color2=oklch(0.7%200.1%20190) -->

		<div style="width: 100%; height: 5em; background: linear-gradient(to right, color(display-p3 0.54199 0.30934 0.26448), color(display-p3 0.55783 0.31818 0.33366), color(display-p3 0.56548 0.33196 0.40432), color(display-p3 0.56507 0.35041 0.47454), color(display-p3 0.55696 0.37309 0.54199), color(display-p3 0.54171 0.39951 0.60414), color(display-p3 0.52008 0.42921 0.6585), color(display-p3 0.49308 0.46166 0.70284), color(display-p3 0.46215 0.4962 0.7354), color(display-p3 0.4294 0.53195 0.75506), color(display-p3 0.39801 0.56785 0.76144), color(display-p3 0.37269 0.6027 0.7549), color(display-p3 0.35949 0.63532 0.73659), color(display-p3 0.36418 0.66463 0.70825), color(display-p3 0.3893 0.68974 0.67222))"></div>

		<p>However, if the hue of the second color is animated to
		<span class="swatch" style="--color: rgb(33.09% 66.63% 81.81%)"></span>&nbsp;oklch(0.7 0.1 230),
		the midpoint of the interpolation will be (30 + 360 + 230) * 0.5 = 310 degrees,
		continuing in the same decreasing direction,
		giving another purple
		<span class="swatch" style="--color: rgb(57.47% 43.44% 67.8%)"></span>&nbsp;oklch(0.6 0.1 310)
		rather than flipping to the opponent color part-way through the animation.</p>

		<!-- https://apps.colorjs.io/gradients/?color1=oklch(0.5%200.1%2030)&color2=oklch(0.7%200.1%20230) -->

		<div style="width: 100%; height: 5em; background: linear-gradient(to right, color(display-p3 0.54199 0.30934 0.26448), color(display-p3 0.55881 0.31921 0.32275), color(display-p3 0.5704 0.33226 0.38231), color(display-p3 0.57674 0.34842 0.44229), color(display-p3 0.57793 0.3675 0.50159), color(display-p3 0.57416 0.38928 0.55894), color(display-p3 0.56573 0.41352 0.613), color(display-p3 0.553 0.44 0.66246), color(display-p3 0.53648 0.46847 0.70607), color(display-p3 0.51682 0.49862 0.74276), color(display-p3 0.49493 0.53008 0.77168), color(display-p3 0.47202 0.56237 0.79226), color(display-p3 0.44976 0.59494 0.80424), color(display-p3 0.43039 0.6272 0.80767), color(display-p3 0.41667 0.65849 0.80292))"></div>

	</div>

	Angles are adjusted so that |θ₂ - θ₁| ∈ (-360, 0]. In pseudo-Javascript:
		<pre>
		if (θ₁ < θ₂) {
			θ₁ += 360;
		}
		</pre>


<!--
 ██████   ██     ██    ███
██    ██  ███   ███   ██ ██
██        ████ ████  ██   ██
██   ████ ██ ███ ██ ██     ██
██    ██  ██     ██ █████████
██    ██  ██     ██ ██     ██
 ██████   ██     ██ ██     ██
-->

<h2 id="gamut-mapping">
Gamut Mapping
</h2>

<h3 id="gamut-mapping-intro">
An Introduction to Gamut Mapping</h3>

Note: This section provides important context for the specific requirements described elsewhere in the document.

<p><i>This section is non-normative</i></p>

<wpt title="This section is not normative, it does not need tests."></wpt>


	When a color in an origin color space
	is converted to another, destination color space
	which has a smaller gamut,
	some colors will be outside the destination gamut.

	For intermediate color calculations,
	these out of gamut values are preserved.
	However, if the destination is the display device
	(a screen, or a printer)
	then out of gamut values must be converted to
	an in-gamut color.

	Gamut mapping is the process of finding an in-gamut color
	with the least objectionable change in visual appearance.

	Some out of gamut colors correspond to real-world colors
	(they could be physically reproduced)
	while others are imaginary colors
	(they lie outside the spectral locus
	and thus would need more than 100% of a single wavelength)
	and could never be physically realized.
	Those colors tend to come from calculations
	such as "make this color 100x as saturated".

	<div class="example" id="ex-lab-corners">
		For example, while theoretically unbounded,
		the CIE Lab <em>(a,b)</em> plane is often implemented
		such that <em>a</em> and <em>b</em> are constrained
		to the range ±127.

		Three of those four corners are outside the spectral locus
		and thus correspond to imaginary colors.

		<figure id="fig-lab-corners">
			<object data="./images/UCS-rec2020-labcorners.svg"></object>
			<figcaption>The four corners of the ±127 (a,b) plane,
				on a UCS chromaticity diagram.
				The outer shape is the spectral locus.
				The larger triangle is the rec2020 gamut,
				while the smaller is sRGB.
			</figcaption>
		</figure>
	</div>

<h4 id="GM-clip">
Clipping</h4>

	The simplest and least acceptable method
	is simply to clip the component values
	to the displayable range.

	Since the motivation for this method is speed,
	clipping is commonly done on gamma-encoded values
	rather than converting them to linear-light.

	This changes the proportions of
	the three primary colors (for an RGB display),
	resulting in a hue shift.

	<div class="example" id="ex-gamut-clip-hue-shift">
		For example,
		consider the color <code>color(srgb-linear 0.5 1 3)</code>.
		Because this is a linear-light color space,
		we can compare the intensities of the three components
		and see that
		the amount of blue light is three times the amount of green,
		while the amount of red light is half that of green.
		There is six times as much blue primary as red.
		In OkLCh, this color has a hue angle of 265.1°

		If we now clip this color
		to bring it into gamut for sRGB,
		we get <code>color(srgb-linear 0.5 1 1)</code>.
		The amount of blue light is the same as green.
		In OkLCh, this color has a hue angle of 196.1°,
		a substantial change of 69°.
	</div>

	When colors are not too far out of gamut,
	clipping can give acceptable results.
	This is particularly true for darker (or negative)
	component values.

	<div class="example" id="ex-gamut-clip-good">
		For example,
		consider the color <code>color(rec2020 0.54 0.9 0)</code>
		which is <code>oklch(80.72% 0.3296 141.6)</code>.

		Converting to p3 colorspace, the negative blue value shows
		the color is out of gamut:
		<code>color(display-p3 0.3265 0.9165 -0.1262)</code>
		which in linear-light is
		<code>color(display-p3-linear 0.0871 0.8205 -0.0146)</code>.

		Clipping the gamma-encoded p3 color to the p3 gamut gives
		<code>color(display-p3 0.3265 0.9165 0)</code>
		which in linear-light is
		<code>color(display-p3-linear 0.0871 0.8205 0)</code>
		which, for comparison, is
		<code>oklch(80.79% 0.3221 142.3)</code>.

		This is a good result;
		the hue angle and lightness have barely changed
		but the chroma is somewhat reduced, as expected.

		In terms of percentages of linear-light red green and blue,
		the red and green are identical
		while the blue is -1.46% higher.
	</div>

	<div class="example" id="ex-gamut-clip-acceptable">
		For example,
		consider the color <code>color(prophoto-rgb 0.2 1.0 0.1)</code>
		which is <code>oklch(85.07% 0.4873 151.4)</code>

		Converting to p3 colorspace, the color is significantly
		out of gamut:
		<code>color(display-p3 -0.5782 1.067 -0.2363)</code>
		which in linear-light is
		<code>color(display-p3-linear -0.2937 1.158 -0.0456)</code>.

		Clipping the gamma-encoded p3 color to the p3 gamut gives
		<code>color(display-p3 0 1 0)</code>
		which in linear-light is, again,
		<code>color(display-p3-linear 0 1 0)</code>
		(component values of exactly 0 or 1 are unaffected by gamma encoding)
		which, for comparison, is
		<code>oklch(84.88% 0.3685 145.6)</code>.

		A less good but still visually acceptable result.
		Here the hue is more affected, a 5.8° change.

		In terms of percentages of linear-light red green and blue,
		red is 57% higher, green is 6.7% lower and blue is 23% higher.
	</div>

<h4 id="GM-closest">
Closest Color (MINDE)</h4>

	A better method is to map colors,
	in a perceptually uniform color space,
	by finding the closest in-gamut color
	(so-called minimum ΔE or <dfn export>MINDE</dfn>).
	Clearly, the success of this technique
	depends on
	the degree of uniformity of the gamut mapping color space
	and the predictive accuracy of the deltaE function used.

	However, when doing gamut mapping
	<!-- (and we are really talking about gamut reduction, here), -->
	changes in Hue are <em>particularly</em> objectionable;
	changes in Chroma are more tolerable,
	and
	small changes in Lightness can also be acceptable
	especially if the alternative is a larger Chroma reduction.
	MINDE weights changes in each dimension equally,
	and thus gives suboptimal results.

<h4 id="GM-chroma">
Chroma Reduction</h4>

	To implement MINDE,
	colors are mapped in a perceptually uniform, <em>polar</em> color space
	by holding the hue constant,
	and reducing the chroma until the color falls in gamut.

	This could be done <em>algorithmically</em>
	by finding the geometric intersection
	of a constant-lightness, constant-hue ray
	with the gamut boundary;
	or <em>iteratively</em>,
	reducing the chroma until it falls in gamut.

	Note: For performance reasons,
	iteration is typically performed by binary search.

<div class="example" id="ex-gamutmap-p3-yellow-to-srgb">
	In this example, Display P3 primary yellow
	(<code>color(display-p3 1 1 0)</code>)
	is being mapped to an sRGB display.
	The gamut mapping color space is OkLCh.

	<pre class="lang-css">color(display-p3 1 1 0)</pre>
	is
	<pre class="lang-css">color(srgb 1 1 -0.3463)</pre>
	which is
	<pre class="lang-css">color(oklch 0.96476 <b>0.24503</b> 110.23)</pre>

	By progressively reducing the chroma component
	until the resulting color falls inside the sRGB gamut
	(has no components negative, or greater than one)
	a gamut mapped color is obtained.

	<pre class="lang-css">
	<span class="swatch" style="--color: rgb(99.116% 99.733% 0.001%)"></span>   color(oklch 0.96476 <b>0.21094</b> 110.23)</pre>
	which is
	<pre class="lang-css">
	<span class="swatch" style="--color: rgb(99.116% 99.733% 0.001%)"></span>   color(srgb 0.99116 0.99733 0.00001)
	</pre>
	<figure id="gamutmap-p3-yellow">
		<img src="images/slice-ok-110.23.svg" alt="" width="776" height="565" >
		<figcaption>A constant-hue slice of OkLCh color space.
			The vertical axis represents lightness,
			the horizontal axis is chroma.
			The color to be mapped,
			shown as a yellow circle,
			has the chroma reduced
			while keeping hue and lightness constant.
			The color therefore moves along the maroon line in the diagram,
			towards the neutral axis on the left.
			The gamut boundary of sRGB
			is shown in green.
		</figcaption>
	</figure>
</div>

<h4 id="GM-excessive-reduction">
Excessive Chroma Reduction</h4>

	Also, this simple MINDE approach will give sub-optimal results
	for certain colors, principally very light colors
	like yellow and cyan,
	if the upper edge of the gamut boundary is shallow,
	or even slightly concave.
	The line of constant lightness can skim just above the gamut boundary,
	resulting in an excessively low chroma in those cases.

	The choice of color space will affect the acceptability of the gamut mapped colors.

	<div class="example" id="CIELCH-p3-yellow-noclip">
		In this example, Display P3 primary yellow (<code>color(display-p3 1 1 0</code>)
		has the chroma progressively reduced in CIE LCH color space.
		<figure id="fig-cielch-p3-yellow-noclip">
			<img src="images/lab-yellow-LCH-fade.svg" alt="" width="700">
			<figcaption>
				In the upper part of this diagram,
				colors which are inside the gamut of sRGB are displayed as-is.
				Colors inside the gamut of Display P3 (but outside sRGB) are in salmon.
				Colors outside the gamut of Display P3 are in red.
				The lower part of the diagram shows the linear-light intensities of
				the Display P3 red, green and blue components.
			</figcaption>
		</figure>
		It can be seen that reduction in CIE LCH chroma makes the red
		intensity curve up, out of Display P3 gamut;
		by the time it falls again the chroma is very low.
		Simple gamut mapping in CIE LCH would give unsatisfactory results.
	</div>

	<div class="example" id="OkLCh-p3-yellow-noclip">
		In this example, Display P3 primary yellow (<code>color(display-p3 1 1 0</code>)
		has the chroma progressively reduced, but this time in OkLCh color space.
		<figure id="fig-oklch=pr=yellow-noclip">
			<img src="images/p3-yellow-oklab.svg" alt="" width="700">
			<figcaption>
				In the upper part of this diagram,
				colors which are inside the gamut of sRGB are displayed as-is.
				Colors inside the gamut of Display P3 (but outside sRGB) are in salmon.
				Colors outside the gamut of Display P3 are in red.
				The lower part of the diagram shows the linear-light intensities of
				the Display P3 red, green and blue components.
			</figcaption>
		</figure>
		It can be seen that reduction in OkLCh chroma is better behaved.
		Colors do not go outside the Display P3 gamut, and the resulting
		gamut-mapped yellow has good chroma.
		Simple gamut mapping in OK LCH would give acceptable results.
	</div>

<h4 id="GM-chroma-local-MINDE">
Chroma Reduction with Local Clipping</h4>

	The simple chroma-reduction algorithm can be improved:
	at each step,
	the color difference is computed between the current mapped color
	and a clipped version of that color.
	If the current color is outside the gamut boundary,
	but the color difference between it and the clipped version
	is below the threshold for a <em>just noticeable difference</em> (JND),
	the clipped version of the color is returned as the mapped result.
	Effectively, this is doing a MINDE mapping at each stage,
	but constrained so the hue and lightness changes
	are very small,
	and thus are not noticeable.

	<div class="example" id="CIELCH-p3-yellow-clip">
		In this example, Display P3 primary yellow (<code>color(display-p3 1 1 0</code>)
		has the chroma progressively reduced in CIE LCH color space,
		with the local clip modification.
		<figure id="fig-cielch-p3-yellow-clip">
			<img src="images/lab-yellow-LCH-clip-fade.svg" alt="" width="700">
			<figcaption>
				In the upper part of this diagram,
				colors which are inside the gamut of sRGB are displayed as-is.
				Colors inside the gamut of Display P3 (but outside sRGB) are in salmon.
				Colors outside the gamut of Display P3 are in red.
				The lower part of the diagram shows the linear-light intensities of
				the Display P3 red, green and blue components.
			</figcaption>
		</figure>
		It can be seen that reduction in CIE LCH chroma still makes the red
		intensity curve up, out of Display P3 gamut;
		but less than before and the sRGB boundary is found much more quickly.
		Gamut mapping in CIE LCH with local clip would give acceptable results.
	</div>

	<div class="example" id="OkLCh-p3-yellow-clip">
		In this example, Display P3 primary yellow (<code>color(display-p3 1 1 0</code>)
		has the chroma progressively reduced, but this time in OkLCh color space
		and with the local clip modification.
		<figure id="fig-oklch-p3-yellow-clip">
			<img src="images/p3-yellow-oklab-clip.svg" alt="" width="700">
			<figcaption>
				In the upper part of this diagram,
				colors which are inside the gamut of sRGB are displayed as-is.
				Colors inside the gamut of Display P3 (but outside sRGB) are in salmon.
				Colors outside the gamut of Display P3 are in red.
				The lower part of the diagram shows the linear-light intensities of
				the Display P3 red, green and blue components.
			</figcaption>
		</figure>
		It can be seen that reduction in OkLCh chroma,
		which was already good,
		is further improved by the local clip modification.
		Simple gamut mapping in CIE LCH with local clip would give excellent results.
	</div>

<h4 id="GM-hue-curvature">
Deviations from Perceptual Uniformity: Hue Curvature</h4>

	Performing gamut mapping in the CIE LCH color space
	even with the deltaE2000 distance metric,
	is known to give suboptimal results
	with significant hue shifts,
	for colors in the hue range
	270° to 330°.

	<figure id="fig-cielch-blue-curvature">
		<img src="images/CIELCH-blue-slice.png" alt="" width="2434">
		<figcaption>
			A constant-hue slice of CIE LCH color space,
			at a hue angle of 301.37°
			corresponding to sRGB primary blue.
			The vertical axis is Lightness, the horizontal axis is Chroma.
			Between chroma of 25 and 75, the hue is visibly purple,
			becoming more blue between 100 and 131.
			The same phenomenon continues past 131,
			but cannot be shown on an sRGB display.
		</figcaption>
	</figure>

	Using OkLCh color space
	and the deltaEOK distance metric
	avoids this issue
	at all hue angles.

	<figure id="fig-oklch-blue-linearity">
		<img src="images/OKLCH-blue-slice.png" alt="" width="2485">
		<figcaption>
			A constant-hue slice of OkLCh color space,
			at a hue angle of 264.06°
			corresponding to sRGB primary blue.
			The vertical axis is Lightness, the horizontal axis is Chroma.
			The hue is visibly the same at all values of chroma,
			up to 0.315 (the sRGB limit at this hue).
			It continues to be constant beyond this point,
			although that cannot be shown on an sRGB diagram.
		</figcaption>
		</figure>


<h3 id="css-gamut-mapping" algorithm="to CSS gamut map">
CSS Gamut Mapping to an RGB Destination</h3>

<wpt title="Actual values of color are not exposed to script, making this hard to test in an automated manner."></wpt>

	The three <dfn export>CSS gamut mapping algorithms</dfn>
	apply to individual,
	Standard Dynamic Range (SDR) CSS colors
	which are out of gamut
	of an RGB display
	and thus require to be <dfn export>css gamut mapped</dfn>.

	Implementations my choose any of the three algorithms
	based on their quality and runtime efficiency tradeoffs,
	and must use their chosen algorithm
	wherever CSS mandates that gamut mapping be performed.

	<ul>
		<li><a href="#GMA-Binary-local-MINDE">Binary Search Gamut Mapping with Local MINDE</a></li>
		<li><a href="#GMA-EdgeSeeker">EdgeSeeker Gamut Mapping</a></li>
		<li><a href="#GMA-Raytrace">Ray Trace Gamut Mapping</a></li>
	</ul>

	<!-- unbounded hsl
	It also applies to colors being converted
	to HSL or HWB, which cannot express
	colors outside the sRGB gamut. -->

	They all implement a relative colorimetric intent,
	thus colors inside the destination gamut are unchanged.

	Note: other situations,
	in particular mapping to printer gamuts
	where the maximum black level is significantly above zero,
	will require different algorithms
	which align the respective black and white points,
	which will result in lightness changes
	for very light and very dark colors
	as chroma is reduced..

	Note: these algorithms are for individual, distinct colors;
	for color images,
	where relationships between neighboring pixels are important
	and the aim is to preserve detail and texture,
	a perceptual rendering intent is more appropriate
	and in that case,
	colors inside the destination gamut
	could be changed.

	All three CSS gamut mapping algorithms aim at
	constant-lightness, constant-hue chroma reduction
	in the <a href="#ok-lab">OkLCh color space</a>.

	For colors which are out of range on the Lightness axis,
	white is returned in the destination color space
	if the Lightness is greater than or equal to 1.0,
	while black is returned in the destination color space
	if the Lightness is less than or equal to 0.0.

<h4 id="GMA-Binary-local-MINDE">
	Binary Search Gamut Mapping with Local MINDE
</h4>

	For this binary search algorithm,
	the color difference formula used is <a href="#color-difference-OK">deltaEOK</a>.
	The <a href="#GM-chroma-local-MINDE">local-MINDE</a> improvement is used.
	At each step in the search,
	the deltaEOK is computed between the current mapped color
	and a clipped version of that color.

	If the current color is <em>outside</em> the gamut boundary,
	but the deltaEOK between it and the clipped version
	is below a threshold for a <em>just noticeable difference</em> (JND),
	the clipped version of the color is returned as the mapped result.
	This gives good results with non-notivceable hue shifts,
	and avoids excessive chroma reduction near concave gamut surfaces,
	but can be computationally intensive.

<!--
	For the geometric implementation,
	having found the exact intersection,
	project outwards (towards higher chroma) along the line of constant lightness
	until either:

	- the deltaEOK between the projected point
		and a clipped version of that point
		exceeds one JND, or
	- the chroma of the projected point is equal to
		the chroma of the original color (i.e. do not project past the original color)

	Then return the clipped version of the color as the mapped result.

-->

	For the OkLCh color space,
	one JND is is an OkLCh difference of 0.02.

	Note: In CIE Lab color space,
	where the range of the Lightness component is 0 to 100,
	using deltaE2000,
	one JND is 2.
	Because the range of Lightness in Oklab and OkLCh
	is 0 to 1,
	using deltaEOK,
	one JND is 100 times smaller.

	Note: for the purposes of experimentation,
	and comparing implementations,
	implementations of the  Binary Search with Local MINDE algorithm are available
	in the Coloriade library (in Python) [[Coloraide-MINDE]]
	and the color.js library (in JavaScript) [[colorjs-MINDE]].

<h4 id="pseudo-binsearch">
Sample Pseudocode for the Binary Search Gamut Mapping with Local MINDE</h4>

<div algorithm="to gamut map a color by binary search with local MINDE">
	To <dfn export>Binary Search Gamut Map with Local MINDE</dfn> a color |origin|
	in color space |origin color space|
	to be in gamut of a destination color space |destination|:

<ol>
	<!-- check if we need gamut mapping at all -->
	<li>if |destination| has no gamut limits (XYZ-D65, XYZ-D50, Lab, LCH, Oklab, OkLCh) convert |origin| to |destination| and return it as the gamut mapped color
	<!-- we do, so convert to OkLCh -->
		<li>let |origin_OkLCh| be |origin| converted
		from |origin color space| to the OkLCh color space</li>
	<!-- constrain to SDR lightness range, which gamut maps to black or white -->
	<li>if the Lightness of |origin_OkLCh| is greater than or equal to 100%,
		convert `oklab(1 0 0 / origin.alpha)` to |destination| and return it as the gamut mapped color</li>
	<li>if the Lightness of |origin_OkLCh| is less than than or equal to 0%,
		convert `oklab(0 0 0 / origin.alpha)` to |destination| and return it as the gamut mapped color</li>
	<li>let inGamut(|color|) be a function which returns true if, when passed a color,
		that color is inside the gamut of |destination|.
		For HSL and HWB, it returns true if the color is inside the gamut of sRGB.
	</li>
	<!-- are we already in gamut? -->
	<li>if inGamut(|origin_OkLCh|) is true, convert |origin_OkLCh| to |destination| and return it as the gamut mapped color</li>
	<!-- now start to gamut map -->
	<li>otherwise, let delta(|one|, |two|) be a function which returns the deltaEOK of color |one| compared to color |two|</li>
	<li>let |JND| be 0.02</li>
	<li>let |epsilon| be 0.0001</li>
	<!-- we already excluded spaces with no gamut limits in the first step, so this is fine -->
	<li>let clip(|color|) be a function which converts |color| to |destination|,
		clamps each component to the bounds of the reference range for that component
		and returns the result</li>

	<!-- is clipped already indistinguishable from origin, and in gamut? -->
	<li>set |current| to |origin_OkLCh|</li>
	<li>set |clipped| to clip(|current|)</li>
	<li>set |E| to delta(|clipped|, |current|)</li>
	<li>if |E| < |JND|
		<ol>
			<li>return |clipped| as the gamut mapped color</li>
		</ol>
	</li>

	<!-- reduce chroma -->
	<li>set |min| to zero</li>
	<li>set |max| to the OkLCh chroma of |origin_OkLCh|</li>
	<li> let |min_inGamut| be a boolean that represents when |min| is still in gamut, and set it to true
	<li>while (|max| - |min| is greater than |epsilon|) repeat the following steps
		<ol>
			<li>set |chroma| to (|min| + |max|) /2</li>
			<li>set the chroma component of |current| to |chroma|</li>
			<li>if |min_inGamut| is true and also if inGamut(|current|) is true, set |min| to |chroma| and continue to repeat these steps</li>
			<li>otherwise, carry out these steps:
				<ol>
					<li>set |clipped| to clip(|current|)</li>
					<li>set |E| to delta(|clipped|, |current|)</li>
					<li>if |E| < |JND|
					<ol>
						<li>if (|JND| - |E| < |epsilon|) return |clipped| as the gamut mapped color</li>
						<li>otherwise,
						<ol>
							<li>set |min_inGamut| to false</li>
							<li>set |min| to |chroma|</li>
						</ol>
						</li>
					</ol>
					</li>
					<li>otherwise, set |max| to |chroma| and continue to repeat these steps</li>
				</ol>
			</li>
		</ol>
	</li>
	<li>return |clipped| as the gamut mapped color</li>
</ol>
</div>

<h4 id="GMA-EdgeSeeker">
	The EdgeSeeker Gamut Mapping
</h4>

	The EdgeSeeker algorithm is a geometric and lookup-table-based approach,
	originally developed by Alexey Ardov
	for the color.js library [[colorjs-EdgeSeeker]].

	For any given hue, the gamut boundary slice
	is represented as a curved top section
	and a linear bottom section,
	joning at the highest chroma point for that hue.

	To initialize this algorithm,
	for a given target RGB space,
	a lookup table (LUT) is constructed
	containing the highest-chroma Oklch color on each hue slice.
	Linear interpolation between closest LUT values
	is used to then estimate the highest-chroma color
	for the exact hue of each color to be gamut mapped.

	Intersection of the constant-lightness ray
	with the gamut boundary is then calculated,
	which is fast for the lower (linear) part of the boundary
	and still fairly fast for the upper (curved) portion.

	This gives good results, at the expense of memory for the LUT.

<h4 id="pseudo-edgeseeker">
Sample Pseudocode for the EdgeSeeker Gamut Mapping</h4>

Issue: add pseudocode for EdgeSeeker GMA

<h4 id="GMA-Raytrace">
	The Ray Trace Gamut Mapping
</h4>

	The Ray Trace algorithm is a geometric approach
	to RGB gamut mapping,
	for fast chroma reduction with constant lightness.
	It was originally developed by Isaac Muse
	for the Coloraide Python Library [[Coloraide-Ray-Trace]].

	The color to be mapped is first converted to Oklch,
	and then the achromatic version of that color is generated,
	which will be the neutral axis anchor.
	These two colors are then converted to
	the linear-light version of the target RGB space.

	Because the gamut boundary is now an axis-aligned cube,
	finding the intersection is faster.

	A ray is cast from the inside of the RGB cube,
	from the anchor point to the current color.
	The intersection along this path
	with the RGB gamut surface is then found;
	this is the first approximation to the gamut mapped color.

	As RGB spaces are not perceptually uniform,
	a constant hue, constant lightness ray
	is actually a curved path in RGB space.

	The first approximation is converted back to Oklch
	to correct the color in the perceptual color space
	by projecting the point back onto the chroma reduction path,
	correcting the color's hue and lightness.
	The corrected color becomes the new current color
	and should be a much closer color on the reduced chroma line.

	This process is repeated (a maximum of three more times),
	each time finding a better, closer color on the path.
	Finally, simple clipping is used to account for floating point math errors.

	The results are comparable to binary search with local MINDE
	using a low JND,
	but resolves much faster
	and within more predictable, consistent time.

	<figure>
		<img src="./images/raytrace-gma.png" alt="">
		<figcaption>Ray Trace gamut mpping to the sRGB gamut,
			showing the curved path of chroma reduction
			as approximated over a maximum
			of four iterations.<br>
			Image copyright Isaac Muse.
		</figcaption>
	</figure>

	Note: for the purposes of experimentation,
	and comparing implementations,
	implementations of the Ray Trace are available
	in the Coloriade library (in Python) [[Coloraide-Ray-Trace]]
	and the color.js library (in JavaScript) [[colorjs-RayTrace]].

<h4 id="pseudo-raytrace">
Sample Pseudocode for the Ray Trace Gamut Mapping</h4>

<div algorithm="to gamut map a color by Ray Tracing">
	To <dfn export>Ray Trace Gamut Map</dfn> a color |origin|
	in color space |origin color space|
	to be in gamut of an RGB destination color space |destination|:

	<ol>
		<!-- check if we need gamut mapping at all -->
		<li>if |destination| has no gamut limits (XYZ-D65, XYZ-D50, Lab, LCH, Oklab, OkLCh) convert |origin| to |destination| and return it as the gamut mapped color
		<!-- we do, so convert to OkLCh -->
		<li>let |origin_OkLCh| be |origin| converted from |origin color space|
			to the OkLCh color space</li>
		<!-- constrain to SDR lightness range, which gamut maps to black or white -->
		<li>if the Lightness of |origin_OkLCh| is greater than or equal to 100%,
			convert `oklab(1 0 0 / origin.alpha)` to |destination| and return it as the gamut mapped color</li>
		<li>if the Lightness of |origin_OkLCh| is less than than or equal to 0%,
			convert `oklab(0 0 0 / origin.alpha)` to |destination| and return it as the gamut mapped color</li>
		<li>let |l_origin| be the OkLCh lightness component of |origin_OkLCh|</li>
		<li>let |h_origin| be the OkLCh hue component of |origin_OkLCh|</li>
		<li>let |anchor| be an achromatic OkLCh color formed with
			|l_origin| as lightness, 0 as chroma and |h_origin| as hue,
			converted to the <em>linear-light</em> form of |destination|
		</li>
		<li>let |origin_rgb| be |origin_OkLCh|
			converted to the <em>linear-light</em> form of |destination|</li>
		<!-- check if we need gamut mapping at all -->
		<li>if |origin_rgb| is not in gamut
			<ul>
				<!-- we do, so perform chroma reduction -->
				<li>let |low| be 0.0 + 1E-12 <a href="#raytrace-footnote-1"><sup>1</sup></a></li>
				<li>let |high| be 1.0 - 1E-12 <a href="#raytrace-footnote-2"><sup>2</sup></a></li>
				<li>let |last| be |origin_rgb|</li>
				<li>for (i=0; i&lt;4; i++)
					<ul>
						<li>if (i > 0)
							<ul>
								<li>let |current_OkLCh| be |origin_rgb| converted to OkLCh</li>
								<li>let the lightness of |current_OkLCh| be |l_origin|</li>
								<li>let the hue of |current_OkLCh| be |h_origin|
									<a href="#raytrace-footnote-3"><sup>3</sup></a></li>
								<li>let |origin_rgb| be |current_OkLCh|
									converted to the <em>linear-light</em> form of |destination|
								</li>
							</ul>
						</li>
						<li><b>Cast a ray</b> from |start| = |anchor| to |end| = |origin_rgb|
							and let |intersection| be
							the intersection of this ray
							with the gamut boundary
						</li>
						<li>if an intersection was not found,
							let |origin_rgb| be |last| and exit the loop
							<a href="#raytrace-footnote-5"><sup>5</sup></a>
						</li>
						<li>if (i >0) AND (each component of |origin_rgb| is between |low| and |high|) then
							let |anchor| be |origin_rgb|
							<a href="#raytrace-footnote-4"><sup>4</sup></a>
						</li>
						<li>let |origin_rgb| be |intersection|</li>
						<li>let |last| be |intersection|</li>
					</ul>
				</li>
			</ul>
		</li>
		<!-- we already excluded spaces with no gamut limits in the first step, so this is fine -->
		<li>let clip(|color|) be a function which converts |color| to |destination|,
		clamps each component to the bounds of the reference range for that component
		and returns the result</li>
		<li>set |clipped| to clip(|origin_rgb|)</li>
		<li>return |clipped| as the gamut mapped color</li>
	</ol>


	<div algorithm="to cast a ray">
		To <dfn export>cast a ray</dfn> through a linear-light RGB space
		from |start| to |end|
		(in gamut mapping,
		|start| is an anchor within the RGB gamut
		and |end| is the gamut mapped color, on the cubical gamut surface):

	<ol>
		<li>let |bmin| and |bmax| be 3-element arrays
			with the gamut's lower and upper bounds, respectively
			<a href="#raytrace-footnote-6"><sup>6</sup></a>
		</li>
		<li>let |tfar| be infinity (or some very large number)</li>
		<li>let |tnear| be -infinity (or some very large, negative number)</li>
		<li>let |direction| be a 3-element array</li>
		<li>for (i = 0; i < 3; i++):
			<ul>
				<li>let |a| be |start| <i>[i]</i></li>
				<li>let |b| be |end| <i>[i]</i></li>
				<li>let |d| be |b| - |a|</li>
				<li>let |direction| <i>[i]</i> be |d|</li>
				<!--  Non parallel cases -->
				<li>if abs(|d|) > 1E-12 <a href="#raytrace-footnote-7"><sup>7</sup></a>
					<ul>
						<li>let |inv_d| be 1 / |d|</li>
						<li>let |t1| be (|bmin| <i>[i]</i> - |a| ) * |inv_d| </li>
						<li>let |t2| be (|bmax| <i>[i]</i> - |a| ) * |inv_d| </li>
						<li>let |tnear| be max(min(|t1|, |t2|), |tnear| )</li>
						<li>let |tfar| be min(max(|t1|, |t2|), |tfar| )</li>
					</ul>
				</li>
				<!-- Impossible parallel case -->
				<li>else if (|a| &lt; |bmin|<i>[i]</i> or |a| > |bmax|<i>[i]</i>)
					<ul>
						<li>return INTERSECTION NOT FOUND</li>
					</ul>
				</li>
			</ul>
		</li>
		<!-- No hit -->
		<li>if (|tnear| > |tfar| or |tfar| &lt; 0)
			<ul>
				<li>return INTERSECTION NOT FOUND</li>
			</ul>
		</li>
		<li>if |tnear| &lt; 0
			<ul>
				<li>let |tnear| be |tfar|
					<a href="#raytrace-footnote-8"><sup>8</sup></a>
				</li>
			</ul>
		</li>
		<li>if |tnear| is infinite (or matches the initial very large value)
			<ul>
				<li>return INTERSECTION NOT FOUND</li>
			</ul>
		</li>
		<li>for (i =0; i &lt; 3; i++):
			<ul>
				<li>let |result| <i>[i]</i> be |start| <i>[i]</i> + |direction| <i>[i]</i> * |tnear| </li>
			</ul>
		</li>
		<li>return |result|</li>
	</ol>
	</div>

	<h5 id="raytrace-footnotes">Footnotes for Ray Trace algorithm</h5>
	<ol>
		<li id="raytrace-footnote-1">
			It is assumed the minimum value is 0
			and that all channels have the same minimum.
			The value should be small relative to the unit type.
			The specifed value of 1e-12 is for 64-bit, but for 32-bit, 1e-6 should be used.</li>
		<li id="raytrace-footnote-2">
			1.0 represents the maximum in-gamut channel value,
			and it is assumed all channels have the same maximum.</li>
		<li id="raytrace-footnote-3">
			This places the current color back on the chroma reduction curve,
			if it has deviated.</li>
		<li id="raytrace-footnote-4">
			This means |origin_rgb| is below the gamut surface,
			so we use it as an anchor closer to the gamut surface.</li>
		<li id="raytrace-footnote-5">
			This is provided for catastrophic failures
			where a specific, perceptual mapping space
			completely breaks down
			due to ridiculously wide colors (outside the visible spectrum).
			It is expected that non-imaginary colors in CSS should never trigger this.
		<li id="raytrace-footnote-6">
			For typical RGB spaces
			where the gamut bounds are 0 and 1 for each component
			this simplifies to a single constant
			rather than a 3-element array.</li>
		<li id="raytrace-footnote-7">
			The value should be small relative to the unit type.
			The specifed value of 1e-12 is for 64-bit, but for 32-bit, 1e-6 should be used.</li>
		<li id="raytrace-footnote-8">
			favoring the first intersection in the direction |start| -> |end| .</li>
	</ol>

</div>

	<!-- unbounded hsl
	<wpt ignore>
		parsing/gamut-mapping.html
	</wpt> -->


<!-- color(display-p3 1 1 0)
	color(oklch 0.96476 0.24503 110.23)
	mapped
	color(oklch 0.9651 0.20983 109.359)
 -->


<!--
████████  ████████  ██████   ███████  ██       ██     ██ ████████
██     ██ ██       ██    ██ ██     ██ ██       ██     ██ ██
██     ██ ██       ██       ██     ██ ██       ██     ██ ██
████████  ██████    ██████  ██     ██ ██       ██     ██ ██████
██   ██   ██             ██ ██     ██ ██        ██   ██  ██
██    ██  ██       ██    ██ ██     ██ ██         ██ ██   ██
██     ██ ████████  ██████   ███████  ████████    ███    ████████
-->

<h2 id='resolving-color-values'>
Resolving <<color>> Values</h2>

	Unless otherwise specified for a particular property,
	[=specified value|specified=] colors are resolved to
	<dfn export lt="computed color">[=computed value|computed=] colors</dfn>
	and then further to <dfn export lt="used color">[=used value|used=] colors</dfn> as described below.

	The [=resolved value=] of a <<color>> is its [=used value=].

	<wpt>
		parsing/color-computed-hex-color.html
		parsing/color-computed-named-color.html
		parsing/color-invalid-hex-color.html
		parsing/color-invalid-named-color.html
		system-color-compute.html
	</wpt>

<h3 id="resolving-sRGB-values">
Resolving sRGB values</h3>

	This applies to:

	* [=hex colors=]
	* ''rgb()'' and ''rgba()'' values
	* ''hsl()'' and ''hsla()'' values
	* ''hwb()'' values
	* [=named colors=]

	It does <em>not</em> apply to:

	* ''color()'' values using the ''srgb'' or ''srgb-linear'' [=color space=]s.

	If the sRGB color was explicitly specified by the author as a [=named color=],
	the [=declared value=] is that named color, converted to
	<a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>.
	The computed and used value
	is the corresponding sRGB color,
	paired with the specified alpha component
	(after clamping to [0, 1])
	and defaulting to opaque if unspecified).

	<div class="example" id="ex-named-case">
			<p>The author-provided mixed-case form below has a declared value in all lowercase.</p>
			<pre class="lang-css"><span class="swatch" style="--color: purple"></span> pUrPlE

			<span class="swatch" style="--color: purple"></span> purple</pre>
	</div>

	<!--
	This is not observable currently

	<div class="example" id="ex-hsl-case">
		<p>For example, the first form below is treated as identical to the second:</p>
		<pre class="lang-css"><span class="swatch" style="--color: hsl(39 100% 50%)"></span> HsL(39 100% 50%)
		<span class="swatch" style="--color: hsl(39 100% 50%)"></span> hsl(39 100% 50%)</pre>
	</div>

	 -->

	<!-- While the function names and named colors
		are <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a>,
		the [=declared value=]
		does not preserve any mixed casing
		and is treated as being all lowercase. -->


	Otherwise, the declared, computed and used value
	is the corresponding sRGB color,
	paired with the specified alpha component
	(after clamping to [0, 1])
	and defaulting to opaque if unspecified).

	For historical reasons, when ''calc()'' in sRGB colors
	resolves to a single value,
	the declared value serialises without the "calc(" ")" wrapper.

	<div class="example" id="ex-srgb-calc-specified">
		For example, if a color is given as
		<span class="swatch" style="--color: rgb(128 127 255)"></span>  rgb(calc(64 * 2) 127 255)
		the declared value will be
		rgb(128 127 255)
		and not
		rgb(calc(128) 127 255).
	</div>

	<div class="example" id="ex-srgb-hsl-calc-specified">
		For example, if a color is given as
		<span class="swatch" style="--color: rgb(255 165.2 0)"></span>  hsl(38.82 calc(2 * 50%) 50%)
		the declared value will be
		rgb(255 165.2 0)
		because the ''calc()'' is lost
		during HSL to RGB conversion.
	</div>

	Also for historical reasons,
	when calc() is simplified down to a single value,
	the color values are clamped to [0.0, 255.0].

	<div class="example" id="ex-srgb-clamped-calc-specified">
		For example, if a color is given as
		<span class="swatch" style="--color: rgb(255 127 0)"></span>  rgb(calc(100 * 4) 127 calc(20 - 35))
		the declared value will be
		rgb(255 127 0)
		and not
		rgb(calc(400) 127 calc(-15)).
	</div>

	This clamping also takes care of values such as ''Infinity'', ''-Infinity'', and ''NaN'' which will clamp at 255, 0 and 0 respectively.

	<div class="example" id="ex-hsl-computed">
		<p>For example, the computed value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(255, 165, 0)"></span> hsl(38.824 100% 50%)</pre>
		<p>is</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(255, 165, 0)"></span> rgb(255, 165, 0)</pre>
	</div>

	<wpt>
		parsing/color-computed-hsl.html
		parsing/color-computed-hwb.html
		parsing/color-computed-rgb.html
	</wpt>


<h3 id="resolving-lab-lch-values">
Resolving Lab and LCH values</h3>

	This applies to ''lab()'' and ''lch()'' values.

		The declared, computed and used value
		is the corresponding CIE Lab or LCH color
		(after clamping of L, C and H)
		paired with the specified alpha component
		(as a <<number>>, not a <<percentage>>;
		and defaulting to opaque if unspecified).

		<div class="example" id="ex-lch-computed">
			<p>For example, the computed value of</p>
			<pre class="lang-css"><span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lch(52.2345% 72.2 56.2 / 1)</pre>
			<p>is</p>
			<pre class="lang-css"><span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lch(52.2345% 72.2 56.2)</pre>
		</div>

		Although the values of a, b and C
		are theoretically unbounded,
		there may be an
		[=implementation-defined limit for values approaching infinity=].

		<wpt>
			parsing/color-computed-lab.html
		</wpt>

<h3 id="resolving-oklab-oklch-values">
Resolving Oklab and OkLCh values</h3>

	This applies to ''oklab()'' and ''oklch()'' values.

		The declared, computed and used value
		is the corresponding Oklab or OkLCh color
		(after clamping of L, C and H)
		paired with the specified alpha component
		(as a <<number>>, not a <<percentage>>;
		and defaulting to opaque if unspecified).

		<div class="example" id="ex-oklch-computed">
			<p>For example, the computed value of</p>
			<pre class="lang-css"><span class="swatch" style="--color: rgb(50.2% 0.7% 49.9%)"></span> oklch(42.1% 0.192 328.6 / 1)</pre>
			<p>is</p>
			<pre class="lang-css"><span class="swatch" style="--color: rgb(50.2% 0.7% 49.9%)"></span> oklch(42.1% 0.192 328.6)</pre>
		</div>

		Although the values of a, b and C
		are theoretically unbounded,
		there may be an
		[=implementation-defined limit for values approaching infinity=].

		<wpt>
			parsing/color-computed-lab.html
		</wpt>

<h3 id="resolving-color-function-values">
Resolving values of the ''color()'' function</h3>

		The declared, computed and used value
		is the color in the specified [=color space=],
		paired with the specified alpha component
		(as a <<number>>, not a <<percentage>>;
		and defaulting to opaque if unspecified).

		<div class="example" id="ex-p3-computed">
			<p>For example,  the computed value of</p>
			<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> color(display-p3 0.823 0.6554 0.2537 /1)</pre>
			<p>is</p>
			<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> color(display-p3 0.823 0.6554 0.2537)</pre>
		</div>

		For colors specified in the ''xyz'' [=color space=],
		which is an alias of the ''xyz-d65'' [=color space=],
		the computed and used value
		is in the ''xyz-d65'' [=color space=].

		<div class="example" id="ex-xyz-computed">
			<p>For example, the computed value of</p>
			<pre class="lang-css"><span class="swatch" style="--color: rgb(95.1% 53.3% 33%)"></span> color(xyz 0.472 0.372 0.131)</pre>
			<p>is</p>
			<pre class="lang-css"><span class="swatch" style="--color: rgb(95.1% 53.3% 33%)"></span> color(xyz-d65 0.472 0.372 0.131)</pre>
		</div>

		Although the values of r, g, b, x, y and z
		are theoretically unbounded,
		there may be an
		[=implementation-defined limit for values approaching infinity=].

		<wpt>
			parsing/color-computed-color-function.html
		</wpt>

<h3 id="resolving-other-colors">Resolving other colors</h3>

	This applies to
	
	* [=system colors=],
	* <a href="#deprecated-system-colors">deprecated system colors</a>
	* ''transparent''
	* ''currentcolor''.

	If the color was explicitly specified by the author 
	as a [=system color=]
	or as a deprecated system color,
	the [=declared value=] is itself, converted to
	<a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>.

	<div class="example" id="ex-system-declared">
		For example, in this html:

		<pre class="lang-html">&lt;mark style="color: <span class="swatch" style="--color: MarkText"></span> MarkText; background: <span class="swatch" style="--color: Mark"></span> Mark">example&lt;/mark></pre>
	
		The declared value for background-color is "mark".
	</div>	

	For [=system colors=], the computed and used value
	is the corresponding color in its color space,
	paired with the specified alpha component
	(after clamping to [0, 1]).

	For <a href="#deprecated-system-colors">deprecated system colors</a>,
	the computed and used value
	is the color
	of the corresponding  [=system color=]
	(as listed in [[#deprecated-system-colors]])
	in its color space,
	paired with the specified alpha component
	(after clamping to [0, 1]).

	<div class="example" id="ex-deprecated-computed">
		For example, given this css:

		<pre class="lang-css">.foo {
			color: <span class="swatch" style="--color: InfoText"></span> InfoText;
		}</pre>

		The corresponding system color for ''InfoText'' is ''CanvasText''.
		Suppose that ''CanvasText'' is #333;
		then the computed value for ''InfoText'' will also be #333;

	</div>

	<div class="example" id="ex-system-resolve">
		For example, in this html:

		<pre class="lang-html">&lt;button style="color: <span class="swatch" style="--color: ButtonText"></span> ButtonText; background: <span class="swatch" style="--color: ButtonFace"></span> ButtonFace">&lt;/button></pre>

		The declared value of the color property is "buttontext"
		while the computed value could be, for example,
		<span class="swatch" style="--color: #000"></span> rgb(0, 0, 0).
	</div>

	However, system colors and deprecated system colors 
	must not be altered by
	[=forced colors mode=].

	The declared value of ''transparent'' is "transparent"
	while the computed and used value  is [=transparent black=].

	The ''currentcolor'' keyword computes to itself.

	In the 'color' property,
	the used value of ''color>/currentcolor'' is the
	resolved [=inherited value=].
	In any other property,
	its used value is the used value of the 'color' property on the same element.

	Note: This means that if the ''<color>/currentcolor'' value is inherited,
	it’s inherited as a keyword,
	not as the value of the 'color' property,
	so descendants will use their own 'color' property to resolve it.

	<div class="example" id="ex-currentcolor-resolve">
		For example, given this html:

		<pre class="lang-html">
			&lt;div>
				&lt;p>Assume this example text is long enough
					to wrap on multiple lines.
				&lt;/p>
			&lt;/div>
		</pre>

		and this css:

		<pre class="lang-css">
			div {
				color: <span class="swatch" style="--color: forestgreen"></span> forestgreen;
				text-shadow: currentColor;
			}
			p {
				color: <span class="swatch" style="--color: mediumseagreen"></span> mediumseagreen;
			}
			p::firstline {
				color: <span class="swatch" style="--color: yellowgreen"></span> yellowgreen;
			}
		</pre>

		The used value of the inherited property text-shadow
		on the first line fragment would be yellowgreen.
	</div>

	<wpt>
		currentcolor-001.html
		currentcolor-002.html
		currentcolor-003.html
		currentcolor-005.html
		system-color-compute.html
	</wpt>

<!--
 ██████  ████████ ████████  ████    ███    ██
██    ██ ██       ██     ██  ██    ██ ██   ██
██       ██       ██     ██  ██   ██   ██  ██
 ██████  ██████   ████████   ██  ██     ██ ██
      ██ ██       ██   ██    ██  █████████ ██
██    ██ ██       ██    ██   ██  ██     ██ ██
 ██████  ████████ ██     ██ ████ ██     ██ ████████
-->

<h2 id='serializing-color-values'>
Serializing <<color>> Values</h2>

This section updates and replaces that part of CSS Object Model, section
<a href="https://drafts.csswg.org/cssom-1/#serializing-css-values"> Serializing CSS Values</a>, which relates to serializing <<color>> values.

In this section, the strings used in the specification and the corresponding characters are as follows.

<table class="data">
	<tr>
		<th>String</th>
		<th>Character(s)</th>
	</tr>
	<tr>
		<td>" "</td>
		<td>U+0020 SPACE</td>
	</tr>
	<tr>
		<td>"#"</td>
		<td>U+0023 NUMBER SIGN</td>
	</tr>
	<tr>
		<td>","</td>
		<td>U+002C COMMA</td>
	</tr>
	<tr>
		<td>"-"</td>
		<td>U+002D HYPHEN-MINUS</td>
	</tr>
	<tr>
		<td>"."</td>
		<td>U+002E FULL STOP</td>
	</tr>
	<tr>
		<td>"/"</td>
		<td>U+002F SOLIDUS</td>
	</tr>
	<tr>
		<td>"none"</td>
		<td>U+006E LATIN SMALL LETTER N<br>
			U+006F LATIN SMALL LETTER O<br>
			U+006E LATIN SMALL LETTER N<br>
			U+0065 LATIN SMALL LETTER E
		</td>
	</tr>

</table>

The string "." shall be used as a decimal separator,
regardless of locale,
and there shall be no thousands separator.

For syntactic forms which support [=missing color components=],
the value ''none'' (equivalently NONE, nOnE, etc),
shall be serialized in all-lowercase
as the string "none".


<h3 id="serializing-alpha-values">
Serializing alpha values</h3>

	This applies to any <<color>> value which can take an optional alpha value.
	It does not apply to the ''opacity'' property.

	If, after clamping to the range [0, 1] the alpha is 1,
	it is omitted from the serialization;
	an implicit value of 1 (fully opaque) is the default.

	If the alpha is any other value than 1,
	it is explicitly included in the serialization as described below.

	For historical reasone,
	the serialization of alpha
	depends on whether the color was specified
	using [=legacy color syntax=]
	or [=modern color syntax=].

<h4 id="serializing-legacy-alpha-values">
Serializing legacy alpha values</h4>

	If the value is internally represented as an integer
	between 0 and 255 inclusive (i.e. 8-bit unsigned integer),
	follow these steps:

	<ol>
		<li>Let <var>alpha</var> be the given integer.
		<li>If there exists an integer between 0 and 100 inclusive that,
		when multiplied with 2.55 and rounded to the closest integer
		(rounding up if two values are equally close), equals <var>alpha</var>,
		let <var>rounded</var> be that integer divided by 100.
		<li>Otherwise, let <var>rounded</var> be <var>alpha</var>
		divided by 0.255 and rounded to the closest integer
		(rounding up if two values are equally close),
		divided by 1000.
		<li>Return the result of serializing <var>rounded</var>
		as a <<number>>.
	</ol>

	Otherwise, return the result of serializing the given value
	(as a <<number>>, not a <<percentage>>),
		the same as the modern alpha serialization.

	<div class="example" id="ex-alpha-255">
		<p>
			For example,
			if the alpha is stored as the 8-bit unsigned integer 237,
			the integer 93 satisfies the criterion
			because Math.round(93 * 2.55) is 237,
			and so the alpha is serialized as "0.93".
		</p>
		<p>
			However,
			if the alpha is stored as the 8-bit unsigned integer 236,
			there is no such integer
			(92 maps to 235 while 94 maps to 240),
			and so since 236 ÷ 0.255 = 925.490196078
			the alpha is serialized as "0.92549"
			(no more than 6 figures, trailing zeroes omitted).
		</p>
	</div>

	For [=legacy color syntax=],
	the precision with which alpha values are retained,
	and thus the number of decimal places in the serialized value,
	must at least be sufficient
	to round-trip integer percentage values.
	Thus, the serialized value must contain
	at least two decimal places
	(unless trailing zeroes have been removed).
	Values must be
	<a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.

	<div class="example" id="ex-alpha-legacy-round">
		<p>For example, an alpha value of 12.3456789%
			could be serialized as the strings
			"0.12" or "0.123" or "0.1234" or "0.12346"
			(rounding the value of 5
			towards +∞
			because the following digit is 6)
			or any longer, rounded serialization of the same form.
		</p>
	</div>

<h4 id="serializing-modern-alpha-values">
Serializing modern alpha values</h4>

	Return the result of serializing the given value
	(as a <<number>>, not a <<percentage>>).

	The <<number>> value is expressed in base ten,
	with the "." character as decimal separator.
	The leading zero must not be omitted.
	Trailing zeroes must be omitted.

	<div class="example" id="ex-alpha-trimzero">
		<p>For example, an alpha value of 70%
			will be serialized as the string
			"0.7"
			which has a leading zero before the decimal separator,
			"." as decimal separator
			(even if the current locale would use some other character,
			such as ","),
			and all digits after the "7" would be "0" and are omitted.
		</p>
	</div>
	
	For [=modern color syntax=],
	the precision with which <<alpha-value>>s are retained,
	and thus the number of decimal places in the serialized value,
	is required to be sufficient
	to round-trip 16-bit decimal values.

	<!-- 
	10 bit is the minimum precision
	required for sRGB or display-p3
	color components
	in modern syntax.

	However
	https://github.com/w3c/csswg-drafts/issues/13994
	concludes that 16 bit
	should be the minimum.

	Implementations in practice
	are using half-float or float.
	-->

	The serialized value must contain
	six decimal places
	(unless trailing zeroes have been removed).

	Values must be
	<a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.

	<div class="example" id="ex-alpha-modern-round">
		<p>For example, an alpha value of 12.3456789%
			will be serialized as the string
			"0.123457"
			(rounding the value
			towards +∞).
		</p>
	</div>

	<div class="example" id="ex-alpha-precision">
		<p>For example,
			given the color color(srgb 1 0 0 / 0.5),
			the alpha value is to be serialized
			as the string "0.5".
			If it were stored at only 10-bit precision,
			the internal value would be 512/1023
			which is 0.50048875855,
			or "0.500489" to six significant figures,
			close to the desired value but not exact.
			At 12-bit that would be
			2048/4095
			which is 0.50012210012,
			which is 0.500122 to six significant figures,
			still not exact.
		</p>
		<p>
			It would also be incorrect to store it as
			128/255
			which is
			0.50196078431,
			or 
			0.501960 to six significant figures.
		</p>
	</div>

	To avoid cumulative round-off errors,
	16bit, half-float, or float per alpha component
	is recommended for internal storage.

	Because <<alpha-value>>s which were specified outside the valid range
	are clamped at parse time, the declared value will be clamped.
	However, per [[css-values-4#calc-range]], <<alpha-value>>s
	specified using calc() are not clamped when the specified form is serialized;
	but the computed values are clamped.

	<div class="example" id="ex-alpha-clamp">
		<p>For example an alpha value which was specified directly as 120%
			would be serialized as the string "1".
			However, if it was specified as calc(2*60%)
			the declared value would be serialized as the string "calc(1.2)".
		</p>
	</div>


<h3 id="serializing-sRGB-values">
Serializing sRGB values</h3>

	The serialized form of the following sRGB values:

	* [=hex colors=]
	* ''rgb()'' and ''rgba()'' values
	* ''hsl()'' and ''hsla()'' values
	* ''hwb()'' values
	* [=named colors=]
	* [=system colors=]
	* <a href="#deprecated-system-colors">deprecated-colors</a>
	* ''transparent''

	<!-- are all system colors assumed to be sRGB?
		https://github.com/w3c/csswg-drafts/issues/8312
	-->

	is derived from the [=declared value=].

	When serializing the value of a property
	which was set by the author to a CSS [=named color=],
	a [=system color=],
	a <a href="#deprecated-system-colors">deprecated-color</a>,
	or ''transparent''
	therefore, for the [=declared value=],
	the <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>
	keyword value is retained.
	For the computed and used value,
	the corresponding sRGB value is used.

	<wpt>
		system-color-compute.html
	</wpt>

	Thus, the serialized declared value of ''transparent'' is the string "transparent",
	while the serialized computed value of ''transparent'' is the string "rgba(0, 0, 0, 0)".

	For all other sRGB values,
	the declared, computed and used value
	is the corresponding sRGB value.

	During serialization,
	any [=missing=] values
	are converted to 0
	if the chosen serialization form
	(such as the <a>legacy color syntax</a> with comma separators,
	or the
	<a href="#HTML-compatible-serialization-of-srgb">HTML-compatible serialization</a>
	of sRGB values)
	cannot represent the ''none'' keyword.
	When at least one component is [=missing=]
	and the value can be serialized in a form which supports ''none'',
	the form is chosen as described in
	[[#css-serialization-of-srgb]]
	so that [=missing color components=] are preserved as ''none''.

	<h4 id="HTML-compatible-serialization-of-srgb">HTML-compatible serialization of sRGB values</h4>

	If the following conditions are all true:

	<ol>
		<li>The color space is sRGB</li>
		<li>The alpha is 1</li>
		<li>The RGB component values are internally represented as integers between 0 and 255 inclusive (i.e. 8-bit unsigned integer)</li>
		<li><dfn export for="color serialization">HTML-compatible serialization is requested</dfn></li>
	</ol>

	Then corresponding sRGB values are serialized in 6-digit [=hex color notation=] as follows:

	A seven-character string consisting of the character "#", followed immediately by the two-digit hexadecimal representations of the red component, the green component, and the blue component, in that order, using <a href="https://infra.spec.whatwg.org/#ascii-lower-hex-digit">ASCII lower hex digits</a>. No spaces are permitted.

	<div class="example" id="ex-canvas-srgb">
		For example, fill style is set to <span class="swatch" style="--color: rgb(255, 0, 255)"></span> magenta:

		<pre class="lang-js">
			context.fillStyle = "rgb(255, 0, 255)"
			console.log(context.fillStyle); // "#ff00ff"
		</pre>

		The color space is sRGB, the representation is 8 bits per component,
		the data format does not produce ''none'' values nor does it support extended range values,
		and the alpha is 1.

		The HTML-compatible serialization is the string "#ff00ff" (not "#FF00FF").
	</div>

	Otherwise, for sRGB the <a href="#css-serialization-of-srgb">CSS serialization of sRGB values is used</a> and for other color spaces, the relevant <a href="#serializing-color-values">serialization</a> of the <<color>> value.

	<div class="example" id="ex-canvas-p3">
		For example, fill style is set to <span class="swatch" style="--color: rgb(48.63% 13.85% 15.73%)"></span>  a dark brown, in CIE Lab:

		<pre class="lang-js">
			context.fillStyle = "lab(29% 39 20)";
			console.log(context.fillStyle); // "lab(29 39 20)"
		</pre>

		The CSS serialization is the string "lab(29 39 20)".
	</div>

	<div class="example" id="ex-srgb-alpha">
		For example, fill style is set to <span class="swatch" style="--color: #ff00ffed"></span> semi-transparent magenta:

		<pre class="lang-js">
			context.fillStyle = "#ff00ffed";
			console.log(context.fillStyle); // "rgba(255, 0, 255, 0.93)"
		</pre>

		The alpha is not 1, so the CSS serialization is the string
		"rgba(255, 0, 255, 0.93)".
	</div>

	<!-- <div class="example" id="ex-srgb-alpha">
		For example, a color picker has returned the following values,
		in the sRGB color space:

		<pre class="lang-js">
			[37, 164, 87, 237]
		</pre>

		The alpha is not 1, so the CSS serialization is the string
		"rgba(37, 164, 87, 0.93)".
	</div> -->

	<h4 id="css-serialization-of-srgb">CSS serialization of sRGB values</h4>

	If the value has no [=missing color components=],
	corresponding sRGB values use either the ''rgb()'' or ''rgba()'' form
	(depending on whether the (clamped) alpha is exactly 1, or not),
	with all <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>
	letters for the function name.

	For compatibility, the sRGB component values
	are serialized in <<number>> form, not <<percentage>>.
	Also for compatibility,
	the component values are serialized in base 10,
	with a range of [0-255], regardless of
	the bit depth with which they are stored.

	<a href="#serializing-alpha-values">As noted earlier</a>,
	unitary alpha values are not explicitly serialized.
	Also, for compatibility, if the alpha is exactly 1,
	the ''rgb()'' form is used,
	with an implicit alpha;
	otherwise, the ''rgba()'' form is used,
	with an explicit alpha value.

	For compatibility,
	the legacy form with comma separators is used;
	exactly one ASCII space follows each comma.
	This includes the comma (not slash) used
	to separate the blue component of ''rgba()''
	from the alpha value.

	However, the <a>legacy color syntax</a> with comma separators
	cannot represent ''none''.
	If the value has at least one [=missing color component=],
	the serialization form is chosen
	to preserve those components as the ''none'' keyword,
	based on the color function of the [=declared value=]:

	* For ''rgb()'' and ''rgba()'' values
		(the only sRGB form in this list whose syntax accepts ''none'';
		[=hex colors=], [=named colors=], [=system colors=],
		<a href="#deprecated-system-colors">deprecated-colors</a>,
		and ''transparent'' have no parametric syntax
		and so never have [=missing color components=]),
		the value is serialized as a ''color()'' function
		in the ''srgb'' [=color space=]
		rather than as the modern space-separated form of ''rgb()'',
		even though that form would also accept ''none'':
		"color(srgb"
		followed by a single space,
		followed by a space-separated list of the three
		non-alpha components serialized as <<number>>s
		in the [0, 1] reference range
		(or as ''none'' if [=missing=]),
		followed (only if the alpha is non-unity or [=missing=])
		by " / "
		and the alpha component
		(serialized per the
		<a href="#serializing-alpha-values">alpha rules</a>,
		or as ''none'' if [=missing=]),
		followed by ")".

	* For ''hsl()'' and ''hsla()'' values,
		the value is serialized using the
		modern (whitespace-separated) ''hsl()'' syntax,
		with a slash before the alpha component when present.
		The function name is "hsl" (in
		<a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>)
		regardless of whether the value was authored
		using the ''hsla()'' alias.
		The hue is serialized as a canonicalized <<number>> in degrees,
		the saturation and lightness as <<percentage>>s,
		and the alpha
		(included only if non-unity or [=missing=])
		per the <a href="#serializing-alpha-values">alpha rules</a>;
		any [=missing component=] is serialized as the ''none'' keyword.

	* For ''hwb()'' values,
		the value is serialized using the
		modern (whitespace-separated) ''hwb()'' syntax,
		with a slash before the alpha component when present.
		The function name is "hwb"
		in <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>.
		The hue is serialized as a canonicalized <<number>> in degrees,
		the whiteness and blackness as <<percentage>>s,
		and the alpha
		(included only if non-unity or [=missing=])
		per the <a href="#serializing-alpha-values">alpha rules</a>;
		any [=missing component=] is serialized as the ''none'' keyword.

	Note: this means that an ''hsl()'' or ''hwb()'' value
	containing ''none'' round-trips through serialization
	in its own color function,
	rather than degrading to ''rgba()'' (whose legacy form cannot represent ''none''),
	while an ''rgb()'' value containing ''none''
	is serialized via ''color(srgb …)''.
	The modern space-separated form of ''rgb()'' could itself represent ''none'',
	but the [[#serializing-color-values|sRGB CSS serialization]] uses ''color(srgb …)'' instead
	for consistency with how all other [=color spaces=] are serialized
	in their non-legacy form.
	This parallels the behavior of relative color syntax
	defined in [[css-color-5#serial-origin-color]].

	<div class="example" id="ex-rgb-ser-int-rgba">
		<p>For example, the serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgba(29, 164, 192, 0.95)"></span> rgb(29 164 192 / 95%)</pre>
		<p>is the string "rgba(29, 164, 192, 0.95)"</p>
	</div>

	<div class="example" id="ex-hwb-serial">
		For example, an author-supplied value:

		<pre class="lang-css">
			<span class="swatch" style="--color: rgb(70% 36.67% 20% / 0.5)"></span> hwb(740deg 20% 30% / 50%)
		</pre>

		Would be normalized first to

		<pre class="lang-css">
			<span class="swatch" style="--color: rgb(70% 36.67% 20% / 0.5)"></span> hwb(20 20% 30% / 50%)
		</pre>

		and then converted to sRGB and serialized as

		<pre class="lang-css">
			<span class="swatch" style="--color: rgb(70% 36.67% 20% / 0.5)"></span> rgba(178.5, 93.5, 51, 0.5)
		</pre>

		The precision of the returned result
		is <a href="#sRGB-precision">described below</a>.

	</div>

	<div class="example" id="ex-hwb-serial-none">
		For example, the author-supplied value

		<pre class="lang-css">hwb(20 none 30% / none)</pre>

		contains [=missing color components=]
		(both the whiteness and the alpha are ''none''),
		so it is <em>not</em> serialized through ''rgba()''.
		Instead, it is serialized using the modern ''hwb()'' syntax as

		<pre class="lang-css">hwb(20 none 30% / none)</pre>

		preserving each ''none'' value.
	</div>

	<div class="example" id="ex-rgb-serial-none">
		Similarly, the author-supplied value

		<pre class="lang-css">rgb(none 0 0)</pre>

		is serialized as

		<pre class="lang-css">color(srgb none 0 0)</pre>

		because ''rgb()'' (in its serialized legacy comma form)
		cannot represent ''none''.
	</div>

	Note: contrary to CSS Color 3,
	the parameters of the ''rgb()'' function
	are of type <<number>>, not <<integer>>.
	Thus, any higher precision than eight bits
	is indicated with a fractional part.

	<p id="sRGB-precision">
	The precision with which sRGB component values are retained,
	and thus the number of significant figures in the serialized value,
	is not defined in this specification,
	but must at least be sufficient
	to round-trip eight bit values.
	Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.
	</p>

	Note: authors of scripts which expect
	color values returned from
	<span style="font-family:monospace">getComputedStyle</span>
	to have <<integer>> component values,
	are advised to update them to also cope with
	<<number>>.

<div class="example" id="ex-rgb-number">
	<p>
	For example,</p>
	<pre class="lang-css"><span class="swatch" style="--color: rgb(57.28% 42.14% 51.46%)"></span> rgb(146.064 107.457 131.223)</pre>
	<p>is now valid, and equal to</p>
	<pre class="lang-css"><span class="swatch" style="--color: rgb(57.28% 42.14% 51.46%)"></span> rgb(57.28% 42.14% 51.46%)</pre>
	<p>A conformant serialized form for both,
	is the string "rgb(146.06, 107.46, 131.2)".</p>
</div>

	Trailing fractional zeroes in any component values must be omitted;
	if the fractional part consists of all zeroes,
	the decimal point must also be omitted.
	This means that sRGB colors specified with integer component values
	will serialize with backwards-compatible integer values.

<div class="example" id="ex-rgb-notrail">
	<p>The serialized computed value of </p>
	<pre class="lang-css"><span class="swatch" style="--color: goldenrod"></span> ''goldenrod''</pre>
	<p>is the string "rgb(218, 165, 32)"
	and not the string "rgb(218.000, 165.000, 32.000)"</p>
</div>



<h3 id="serializing-lab-lch">
Serializing Lab and LCH values</h3>

	The serialized form of ''lch()'' and ''lab()'' values
	is derived from the [=computed value=]
	and uses the ''lab()'' or ''lch()'' forms,
	with <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>
	letters for the function name.

	The component values are serialized in base 10;
	the L, a, b and C component values
	are serialized as <<number>>,
	using the <a href="#prr-lab">Lab percentage reference ranges</a>
	or the <a href="#prr-lch">LCH percentage reference ranges</a>
	as appropriate
	to perform percentage to number conversion;
	thus 0% L maps to 0
	and 100% L maps to 100.
	A single ASCII space character " "
	must be used as the separator
	between the component values.

	<wpt>
		parsing/color-computed.html
	</wpt>

	<div class="example" id="ex-lab-zero-a">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(60.7% 52.23% 0%)"></span> lab(56.200% 0.000 83.600)</pre>
		<p>is the string "lab(56.2 0 83.6)"</p>
	</div>

	<div class="example" id="ex-lab-percent-b">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(60.7% 52.23% 0%)"></span> lab(56.200% 0.000 66.88%)</pre>
		<p>is the string "lab(56.2 0 83.6)"</p>
	</div>

	Trailing fractional zeroes in any component values must be omitted;
	if the fractional part consists of all zeroes,
	the decimal point must also be omitted.

	<div class="example" id="ex-lch-serial">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(41.66% 15.34% 90.66%)"></span> lch(37% 105.0 305.00)</pre>
		<p>is the string "lch(37 105 305)",
			not "lch(37 105.0 305.00)".
	</div>

	The precision with which ''lab()'' component values are retained,
	and thus the number of significant figures in the serialized value,
	is not defined in this specification,
	but due to the wide gamut must be sufficient
	to round-trip L values between 0 and 100,
	and a and b values between ±127,
	with at least sixteen bit precision;
	this will result in at least three decimal places
	unless trailing zeroes have been omitted.
	(half float or float, is recommended for internal storage).
	Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.

	Note: a and b values outside ±125 are possible
	with ultrawide gamut spaces. For example, <em>all</em>
	of the ''prophoto-rgb'' primaries and secondaries
	exceed this range, but are within ±200.

	<a href="#serializing-alpha-values">As noted earlier</a>,
	unitary alpha values are not explicitly serialized.
	Non-unitary alpha values must be explicitly serialized,
	and the string " / "
	(an ASCII space, then forward slash, then another space)
	must be used to separate the b component value from the alpha value.

	<div class="example" id="ex-lch-alpha">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgba(99.56%, 6.09%, 57.02%, 0.93)"></span> lch(56.2% 83.6 357.4 /93%)</pre>
		<p>is the string "lch(56.2 83.6 357.4 / 0.93)"
			not "lch(56.2% 83.6 357.4 / 0.93)"
		</p>
	</div>

<h3 id="serializing-oklab-oklch">
Serializing Oklab and OkLCh values</h3>

	The serialized form of ''oklch()'' and ''oklab()'' values
	is derived from the [=computed value=]
	and uses the ''oklab()'' or ''oklch()'' forms,
	with <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>
	letters for the function name.

	The component values are serialized in base 10;
	the L, a, b and C component values
	are serialized as <<number>>
	using the <a href="#prr-oklab">Oklab percentage reference ranges</a>
	or the <a href="#prr-oklch">OkLCh percentage reference ranges</a>
	as appropriate
	to perform percentage to number conversion;
	thus 0% L maps to 0
	and 100% L maps to 1.0.
	A single ASCII space character " "
	must be used as the separator
	between the component values.

	<wpt>
		parsing/color-computed.html
	</wpt>

	<div class="example" id="ex-oklab-trailzero">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(0% 50.52% 49.07%)">
		</span> oklab(54.0% -0.10 -0.02)</pre>
		<p>is the string "oklab(0.54 -0.1 -0.02)"
			not "oklab(54 -0.1 -0.02)" or
			"oklab(54% -0.1 -0.02)"
		</p>
	</div>

	<div class="example" id="ex-oklab-percent-a-b">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(0% 50.52% 49.07%)">
		</span> oklab(54.0 -25% -5%)</pre>
		<p>is the string "oklab(0.54 -0.1 -0.02)"
			not "oklab(54 -0.25 -0.05)"
		</p>
	</div>

	Trailing fractional zeroes in any component values must be omitted;
	if the fractional part consists of all zeroes,
	the decimal point must also be omitted.

	<div class="example" id="ex-oklch-serial">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(42.07% 49.6% 25.23%)"></span> oklch(56.43% 0.0900 123.40)</pre>
		<p>is the string "oklch(0.5643 0.09 123.4)",
			not "oklch(0.5643 0.0900 123.40)".
	</div>

	The precision with which ''oklab()'' component values are retained,
	and thus the number of significant figures in the serialized value,
	is not defined in this specification,
	but due to the wide gamut must be sufficient
	to round-trip L values between 0 and 1 (0% and 100%),
	<!--
		ensure rec2020 round trips
		color(rec2020 1 0 0) = oklch(68.7 0.365 24.19)
		color(rec2020 0 1 0) = oklch(83 0.468 152.6)
		color(rec2020 0 0 1) = oklch(42.3 0.383 245.1)
	-->
	and a, b and C values between ±0.5,
	with at least sixteen bit precision;
	this will result in at least five decimal places
	unless trailing zeroes have been omitted.
	(half float or float, is recommended for internal storage).
	Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.

	<!--
	color(prophoto-rgb 1 0 0) = oklch(70.2 0.432 19.58)
	color(prophoto-rgb 0 1 0) = oklch(84 0.526 152.8)
	color(prophoto-rgb 0 0 1) = oklch(21.7 1.413 197.6)
	-->
	Note: a, b and C values outside ±0.5 are possible
	with ultrawide gamut spaces. For example,
	the ''prophoto-rgb'' green and blue primaries
	exceed this range,
	with C of 0.526 and 1.413 respectively.

	<a href="#serializing-alpha-values">As noted earlier</a>,
	unitary alpha values are not explicitly serialized.
	Non-unitary alpha values must be explicitly serialized,
	and the string " / "
	(an ASCII space, then forward slash, then another space)
	must be used to separate the final color component (b, or C) value from the alpha value.

	<div class="example" id="ex-oklch-alpha">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgba(60%, 26.67%, 66.67%, 0.7)"></span> oklch(53.85% 0.1725 320.67 / 70%)</pre>
		<p>is the string "oklch(0.5385 0.1725 320.67 / 0.7)"</p>
	</div>

<h3 id="serializing-color-function-values">
Serializing values of the ''color()'' function</h3>

	The serialized form of ''color()'' values
	is derived from the [=computed value=]
	and uses the ''color()'' form,
	with <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>
	letters for the function name
	and the color space name.

	The component values are serialized in base 10,
	as <<number>>.
	A single ASCII space character " "
	must be used as the separator
	between the component values,
	and also between the color space name and the first color component.

	<wpt>
		parsing/color-computed.html
	</wpt>

	<div class="example" id="ex-color-serial">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgba(99.56%, 6.09%, 57.02%, 0.93)"></span> color(dIsPlAy-P3  0.964  0.763  0.787)</pre>
		<p>is the string "color(display-p3 0.96 0.76 0.79)",
		if two decimal places are retained.
		Notice that 0.787 has rounded up to 0.79,
		rather than being truncated to 0.78.
		</p>
	</div>

	Trailing fractional zeroes in any component values must be omitted;
	if the fractional part consists of all zeroes,
	the decimal point must also be omitted.

	<div class="example" id="ex-color-trailzero">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgb(15.06% 71.88% 34.64%)"></span> color(rec2020 0.400 0.660 0.340)</pre>
		<p>is the string "color(rec2020 0.4 0.66 0.34)",
			not "color(rec2020 0.400 0.660 0.340)".
	</div>

	<!--
		the name in the @color-profile is also lowercased, right?
		the serialization is not sufficient because the name and the link to the profile are also needed.
	-->

	If the color space is sRGB, the color space is still explicitly required in the serialized result.

	For the predefined color spaces,
	the <em>minimum</em> precision for round-tripping is as follows:

	<table class="data" id="predefined-precision-table">
		<tr><th>color space</th><th>Minimum bits</th></tr>
		<tr>
			<td>''srgb''</td>
			<td>10</td>
		</tr>
		<tr>
			<td>''srgb-linear''</td>
			<td>12</td>
			<!-- see workings/srgb-lin-precision.js -->
		</tr>
		<tr>
			<td>''display-p3''</td>
			<td>10</td>
		</tr>
		<tr>
			<td>''display-p3-linear''</td>
			<td>12</td>
		</tr>
		<tr>
			<td>''a98-rgb''</td>
			<td>10</td>
		</tr>
		<tr>
			<td>''prophoto-rgb''</td>
			<td>12</td>
		</tr>
		<tr>
			<td>''rec2020''</td>
			<td>12</td>
		</tr>
		<tr>
			<td>''xyz'', ''xyz-d50'', ''xyz-d65''</td>
			<td>16</td>
		</tr>
	</table>

	(16bit, half-float, or float <em>per component</em>
	is recommended for internal storage).
	Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.

	Note: compared to the legacy forms
	such as ''rgb()'', ''hsl()'' and so on,
	''color(srgb)'' has a higher minimum precision requirement.
	Stylesheet authors who prefer higher precision
	are thus encouraged to use the ''color(srgb)'' form.

	<a href="#serializing-alpha-values">As noted earlier</a>,
	unitary alpha values are not explicitly serialized.
	Non-unitary alpha values must be explicitly serialized,
	and the string " / "
	(an ASCII space, then forward slash, then another space)
	must be used to separate
	the final color component value
	from the alpha value.

	<div class="example" id="ex-color-prophoto-alpha-serial">
		<p>The serialized value of</p>
		<pre class="lang-css"><span class="swatch" style="--color: rgba(0.003%, 50.196%, 50.196%, 0.85)"></span> color(prophoto-rgb 0.2804 0.40283 0.42259/85%)</pre>
		<p>is the string "color(prophoto-rgb 0.28 0.403 0.423 / 0.85)",
		if three decimal places are retained.
		</p>
	</div>


<h3 id="serializing-other-colors">
Serializing other colors</h3>

	This applies to
	''currentcolor''.

	The serialized form of this value
	is derived from the [=computed value=]
	and uses <a href="https://infra.spec.whatwg.org/#ascii-lowercase">ASCII lowercase</a>
	letters for the color name.

	The serialized form of ''currentColor'' is the string "currentcolor".

<!-- Big Text: Opacity Serial

 ███▌  ████▌   ███▌   ███▌  ████ █████▌ █   ▐▌      ███▌  █████▌ ████▌  ████  ███▌  █▌
█▌  █▌ █▌  █▌ ▐█ ▐█  █▌  █▌  ▐▌    █▌   ▐▌  █      █▌  █▌ █▌     █▌  █▌  ▐▌  ▐█ ▐█  █▌
█▌  █▌ █▌  █▌ █▌  █▌ █▌      ▐▌    █▌    █ ▐▌      █▌     █▌     █▌  █▌  ▐▌  █▌  █▌ █▌
█▌  █▌ ████▌  █▌  █▌ █▌      ▐▌    █▌    ▐▌█        ███▌  ████   ████▌   ▐▌  █▌  █▌ █▌
█▌  █▌ █▌     █████▌ █▌      ▐▌    █▌     █▌           █▌ █▌     █▌▐█    ▐▌  █████▌ █▌
█▌  █▌ █▌     █▌  █▌ █▌  █▌  ▐▌    █▌     █▌       █▌  █▌ █▌     █▌ ▐█   ▐▌  █▌  █▌ █▌
 ███▌  █▌     █▌  █▌  ███▌  ████   █▌     █▌        ███▌  █████▌ █▌  █▌ ████ █▌  █▌ █████
-->

<h2 id='serializing-opacity-values'>
Serializing <<opacity-value>></h2>

	This applies to the ''opacity'' property.

	If the specified value for an opacity value
	matches a literal <<percentage-token>>
	(i.e. does not use ''calc()'')
	it should be serialized as the equivalent
	<<number>> (0% maps to 0, 100% maps to 1) value.
	value.
	Otherwise, the specified value
	for an opacity value
	should serialize using
	the standard serialization for the grammar.

	<!-- The specified given opacity value is serialized
	as a <<number>>, not a <<percentage>>. -->

	This <<number>> value is expressed in base ten,
	with the "." character as decimal separator.
	The leading zero must not be omitted.
	Trailing zeroes must be omitted.

	Opacity values outside the range [0,1]
	are preserved, without clamping, in the serialized specified value.

	The precision with which opacity values are retained,
	and thus the number of decimal places in the serialized value,
	is not defined in this specification,
	but must at least be sufficient
	to round-trip integer percentage values.
	Thus, the serialized value must contain
	at least two decimal places
	(unless trailing zeroes have been removed).
	Values must be
	<a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded
	towards +∞</a>, not truncated.


<!--
 ██████  ████████ ██    ██ ██       ████████       ████████  ██     ██ ██       ████████  ██████
██    ██    ██     ██  ██  ██       ██             ██     ██ ██     ██ ██       ██       ██    ██
██          ██      ████   ██       ██             ██     ██ ██     ██ ██       ██       ██
 ██████     ██       ██    ██       ██████         ████████  ██     ██ ██       ██████    ██████
      ██    ██       ██    ██       ██             ██   ██   ██     ██ ██       ██             ██
██    ██    ██       ██    ██       ██             ██    ██  ██     ██ ██       ██       ██    ██
 ██████     ██       ██    ████████ ████████       ██     ██  ███████  ████████ ████████  ██████
-->

<h2 id="sample">
Default Style Rules</h2>

	The following stylesheet is informative, not normative.  This style sheet could be used by an implementation as part of its default styling of HTML documents.

	<pre class="lang-css">
	/* traditional desktop user agent colors for hyperlinks */
	:link { color: LinkText; }
	:visited { color: VisitedText; }
	:active { color: ActiveText; }

	</pre>

<!--
 ██████   ███████  ████████  ████████
██    ██ ██     ██ ██     ██ ██
██       ██     ██ ██     ██ ██
██       ██     ██ ██     ██ ██████
██       ██     ██ ██     ██ ██
██    ██ ██     ██ ██     ██ ██
 ██████   ███████  ████████  ████████
-->

<h2 id="color-conversion-code">
Sample code for Color Conversions</h2>

<em>This section is not normative.</em>
<wpt title="This section is not normative, it does not need tests."></wpt>


For clarity, <a href="multiply-matrices.js">a library</a> is used for matrix multiplication.
(This is more readable than inlining all the multiplies and adds).
The matrices are in <a href="https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/geometry/row-major-vs-column-major-vector">column-major order</a>.

<pre class="include-code lang-javascript">
path: conversions.js
highlight: js
</pre>

<!--
████████  ████████ ██     ████████    ███        ████████
██     ██ ██       ██        ██      ██ ██       ██
██     ██ ██       ██        ██     ██   ██      ██
██     ██ ██████   ██        ██    ██     ██     ██████
██     ██ ██       ██        ██    █████████     ██
██     ██ ██       ██        ██    ██     ██     ██
████████  ████████ ████████  ██    ██     ██     ████████
-->

<h2 id="color-difference-code">
Color Difference Formulae</h2>

<em>This section is not normative.</em>
<wpt title="This section is not normative, it does not need tests."></wpt>

<h3 id="color-differences-intro">
Introduction to Color Difference metrics.
</h3>

<p>
	A color difference formula estimates how different two colors <em>appear</em>.
	It can be used for quality assurance
	(measuring whether a reproduced color is correct),
	or for some types of gamut mapping,
	where the color difference between
	the out of gamut and in-gamut colors is minimized.
</p>

<p>
	Historically, the general class of color difference formulae
	is called ΔE (delta E);
	where the E is short for Empfindung,
	the German word for "sensation".
</p>

<p>
	The simplest color difference metric, ΔE76,
	is simply the Euclidean distance in CIE Lab color space,
	which first became an International Standard in 1976.
</p>

<p>
	While ΔE76 is a good first approximation,
	color-critical industries such as printing and fabric dyeing
	soon developed improved formulae
	as the limitations of CIE Lab became evident.
</p>

<p>
	As formulae became more complex,
	practical implementations needed to trade off
	predictive accuracy
	against computational complexity (and thus, speed).
</p>


<h3 id="color-difference-2000">ΔE2000</h3>
<p>
	Currently, the most widely used formula
	for standard dynamic range colors
	is ΔE2000.
	It corrects a number of known asymmetries and non-linearities
	compared to ΔE76.
	Because the formula is complex,
	and critically dependent on the sign
	of various intermediate calculations,
	implementations are often incorrect [[Sharma]].
</p>

<p>
	The sample code below has been
	<a href="https://colorjs.io/test/?test=delta">validated</a>
	to five significant figures
	against the test suite of paired Lab values and expected ΔE2000
	published by [[Sharma]] and is correct.
</p>

<pre class="include-code lang-javascript">
path: deltaE2000.js
highlight: js
</pre>

<h3 id="color-difference-OK">ΔEOK</h3>
<p>
	Because Oklab does not suffer from
	the hue linearity, hue uniformity,
	and chroma non-linearities of CIE Lab,
	the color difference metric does not need to correct for them
	and so ΔEOK
	is simply the Euclidean distance in Oklab color space.
</p>

<pre class="include-code lang-javascript">
	path: deltaEOK.js
	highlight: js
	</pre>

<h3 id="color-difference-OK2">ΔEOK2</h3>
<p>
	As a color difference metric, ΔEOK
	under-estimates differences in colorfulness,
	compared to differences in lightness.
	Experimentation revealed that
	<a href="https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-945714988">scaling</a>
	''a'' and ''b'' by a factor of 2,
	greatly <a href="https://github.com/svgeesus/deltaE-OK2/tree/main">increased 
	the predictive accuracy of an Oklab-based ΔE</a>,
	when compared to ΔE2000.
	Instead of changing the definition of Oklab,
	which is now widely adopted,
	this produces another distance metric ΔEOK2.
</p>

<pre class="include-code lang-javascript">
	path: deltaEOK2.js
	highlight: js
	</pre>

<h3 id="color-difference-OK2r">ΔEOKr2</h3>
<p>
	A further improvement can be made
	by modifying the Lightness axis
	<a href="https://bottosson.github.io/posts/colorpicker/#intermission---a-new-lightness-estimate-for-oklab">to
	add a "toe"</a>.
	This is particularly helpful where there is
	a significant white adaptive stimulus
	(for example, a light-mode web page with a white background).
	It also makes the lighness curve more similar to that of CIE Lab.
</p>

<figure>
	<img src="./images/oklab-Lr-vs-L.svg" alt="" width="560" height="520">
	<figcaption>Lightness functions of Oklrab and CIE Lab compared to Oklab.</figcaption>
</figure>

<p>
	In a color difference metric,
	this is used in combination with the ''a'' and ''b'' scaling.
</p>

<p>
	While this is somewhat more complex than the original ΔEOK,
	it agrees significantly better with ΔE2000,
	while still being far less complex than ΔE2000.
</p>
	
<p><strong>Implementations which are performance-sensitive
	are encouraged to use ΔEOKr2 as a color difference metric.</strong>
</p>

<pre class="include-code lang-javascript">
	path: deltaEOKr2.js
	highlight: js
	</pre>

<!--
████████  ████████ ████████  ████████  ████████  ██████     ███    ████████ ████████ ████████
██     ██ ██       ██     ██ ██     ██ ██       ██    ██   ██ ██      ██    ██       ██     ██
██     ██ ██       ██     ██ ██     ██ ██       ██        ██   ██     ██    ██       ██     ██
██     ██ ██████   ████████  ████████  ██████   ██       ██     ██    ██    ██████   ██     ██
██     ██ ██       ██        ██   ██   ██       ██       █████████    ██    ██       ██     ██
██     ██ ██       ██        ██    ██  ██       ██    ██ ██     ██    ██    ██       ██     ██
████████  ████████ ██        ██     ██ ████████  ██████  ██     ██    ██    ████████ ████████
-->

<h2 id="deprecated-system-colors" class="no-num">
Appendix A: Deprecated CSS System Colors</h2>

	Earlier versions of CSS defined several additional [=system colors=].
	These color keywords have been <strong>deprecated</strong>, however,
	as they are insufficient for their original purpose
	(making website elements look like their native OS counterparts),
	represent a security risk
	by making it easier for a webpage to “spoof” a native OS dialog,
	and increase fingerprinting surface, compromising user privacy.

	User agents must support these keywords,
	and to mitigate fingerprinting
	must map them to the (undeprecated) [=system colors=]
	as listed below.
	<strong>Authors must not use these keywords.</strong>

	The deprecated system colors are represented
	as the <dfn export><<deprecated-color>></dfn> sub-type,
	and are defined as:

	<dl dfn-type="value" dfn-for="<color>, <deprecated-color>">
		<dt><dfn>ActiveBorder</dfn>
		<dd>Active window border. Computes to the color of ''ButtonBorder''.

		<dt><dfn>ActiveCaption</dfn>
		<dd>Active window caption. Computes to the color of ''Canvas''.

		<dt><dfn>AppWorkspace</dfn>
		<dd>Background color of multiple document interface. Computes to the color of ''Canvas''.

		<dt><dfn>Background</dfn>
		<dd>Desktop background. Computes to the color of ''Canvas''.

		<dt><dfn>ButtonHighlight</dfn>
		<dd>The color of the border facing the light source for 3-D elements
		that appear 3-D due to one layer of surrounding border. Computes to the color of ''ButtonFace''.

		<dt><dfn>ButtonShadow</dfn>
		<dd>The color of the border away from the light source for 3-D elements
		that appear 3-D due to one layer of surrounding border. Computes to the color of ''ButtonFace''.

		<dt><dfn>CaptionText</dfn>
		<dd>Text in caption, size box, and scrollbar arrow box. Computes to the color of ''CanvasText''.

		<dt><dfn>InactiveBorder</dfn>
		<dd>Inactive window border. Computes to the color of ''ButtonBorder''.

		<dt><dfn>InactiveCaption</dfn>
		<dd>Inactive window caption. Computes to the color of ''Canvas''.

		<dt><dfn>InactiveCaptionText</dfn>
		<dd>Color of text in an inactive caption. Computes to the color of ''GrayText''.

		<dt><dfn>InfoBackground</dfn>
		<dd>Background color for tooltip controls. Computes to the color of ''Canvas''.

		<dt><dfn>InfoText</dfn>
		<dd>Text color for tooltip controls. Computes to the color of ''CanvasText''.

		<dt><dfn>Menu</dfn>
		<dd>Menu background. Computes to the color of ''Canvas''.

		<dt><dfn>MenuText</dfn>
		<dd>Text in menus. Computes to the color of ''CanvasText''.

		<dt><dfn>Scrollbar</dfn>
		<dd>Scroll bar gray area. Computes to the color of ''Canvas''.

		<dt><dfn>ThreeDDarkShadow</dfn>
		<dd>The color of the darker (generally outer) of the two borders away
		from the light source for 3-D elements that appear 3-D due to two
		concentric layers of surrounding border. Computes to the color of ''ButtonBorder''.

		<dt><dfn>ThreeDFace</dfn>
		<dd>The face background color for 3-D elements that appear 3-D due to
		two concentric layers of surrounding border. Computes to the color of ''ButtonFace''.

		<dt><dfn>ThreeDHighlight</dfn>
		<dd>The color of the lighter (generally outer) of the two borders facing
		the light source for 3-D elements that appear 3-D due to two
		concentric layers of surrounding border. Computes to the color of ''ButtonBorder''.

		<dt><dfn>ThreeDLightShadow</dfn>
		<dd>The color of the darker (generally inner) of the two borders facing
		the light source for 3-D elements that appear 3-D due to two
		concentric layers of surrounding border. Computes to the color of ''ButtonBorder''.

		<dt><dfn>ThreeDShadow</dfn>
		<dd>The color of the lighter (generally inner) of the two borders away
		from the light source for 3-D elements that appear 3-D due to two
		concentric layers of surrounding border. Computes to the color of ''ButtonBorder''.

		<dt><dfn>Window</dfn>
		<dd>Window background. Computes to the color of ''Canvas''.

		<dt><dfn>WindowFrame</dfn>
		<dd>Window frame. Computes to the color of ''ButtonBorder''.

		<dt><dfn>WindowText</dfn>
		<dd>Text in windows. Computes to the color of ''CanvasText''.
	</dl>

	<wpt>
		deprecated-sameas-001.html
		deprecated-sameas-002.html
		deprecated-sameas-003.html
		deprecated-sameas-004.html
		deprecated-sameas-005.html
		deprecated-sameas-006.html
		deprecated-sameas-007.html
		deprecated-sameas-008.html
		deprecated-sameas-009.html
		deprecated-sameas-010.html
		deprecated-sameas-011.html
		deprecated-sameas-012.html
		deprecated-sameas-013.html
		deprecated-sameas-014.html
		deprecated-sameas-015.html
		deprecated-sameas-016.html
		deprecated-sameas-017.html
		deprecated-sameas-018.html
		deprecated-sameas-019.html
		deprecated-sameas-020.html
		deprecated-sameas-021.html
		deprecated-sameas-022.html
		deprecated-sameas-023.html
	</wpt>

<!--
 ███████  ██     ██ ████ ████████  ██    ██  ██████
██     ██ ██     ██  ██  ██     ██ ██   ██  ██    ██
██     ██ ██     ██  ██  ██     ██ ██  ██   ██
██     ██ ██     ██  ██  ████████  █████     ██████
██  ██ ██ ██     ██  ██  ██   ██   ██  ██         ██
██    ██  ██     ██  ██  ██    ██  ██   ██  ██    ██
 █████ ██  ███████  ████ ██     ██ ██    ██  ██████
-->

<h2 id='quirky-color' class="no-num">
Appendix B: Deprecated Quirky Hex Colors</h2>

	When CSS is being parsed in [=quirks mode=],
	<dfn type><<quirky-color>></dfn> is a type of <<color>>
	that is only valid in certain properties:

	* 'background-color'
	* 'border-color'
	* 'border-top-color'
	* 'border-right-color'
	* 'border-bottom-color'
	* 'border-left-color'
	* 'color'

	It is <em>not</em> valid in properties that include or reference these properties,
	such as the 'background' shorthand,
	or inside [=functional notations=]
	<span class="non-normative">such as ''color-mix()''</span>

	Additionally, while <<quirky-color>> must be valid as a <<color>>
	when parsing the affected properties in the ''@supports'' rule,
	it is <em>not</em> valid for those properties
	when used in the {{CSS/supports(conditionText)|CSS.supports()}} method.

	A <<quirky-color>> can be represented
	as a <<number-token>>, <<dimension-token>>, or <<ident-token>>,
	according to the following rules:

	* If it's an <<ident-token>>,
		the token's representation must contain exactly 3 or 6 characters,
		all hexadecimal digits.
		It represents a <<hex-color>> with the same value.

	* If it's a <<number-token>>,
		it must have its integer flag set.

		Serialize the integer's value.
		If the serialization has less than 6 characters,
		prepend "0" characters to it until it is 6 characters long.
		It represents a <<hex-color>> with the same value.

	* If it's a <<dimension-token>>,
		it must have its integer flag set.

		Serialize the integer's value,
		and append the representation of the token's unit.
		If the result has less than 6 characters,
		prepend "0" characters to it until it is 6 characters long.
		It represents a <<hex-color>> with the same value.

	(In other words, Quirks Mode allows hex colors to be written without the leading "#",
	but with weird parsing rules.)

	<wpt title="quirky hex colors"></wpt>


<!--
   ███     ██████  ██    ██
  ██ ██   ██    ██ ██   ██
 ██   ██  ██       ██  ██
██     ██ ██       █████
█████████ ██       ██  ██
██     ██ ██    ██ ██   ██
██     ██  ██████  ██    ██
-->

<h2 id="acknowledgments" class="no-num no-ref">
Acknowledgments</h2>

In addition to <a href="https://www.w3.org/TR/css-color-3/#acknowledgments">those
who contributed to CSS Color 3</a>, the editors would like to thank
Emilio Cobos Álvarez, Alexey Ardov, Chris Bai, Amelia Bellamy-Royds, Lars Borg, Mike Bremford, Andreu Botella, Dan Burzo, Max Derhak, fantasai, Simon Fraser, Devon Govett, Phil Green, Dean Jackson, Andreas Kraushaar, Pierre-Anthony Lemieux, Tiaan Louw, Cameron McCormack, Romain Menke, Chris Murphy, Isaac Muse, Jonathan Neal, Chris Needham, Björn Ottosson, Christoph Päper, Brad Pettit, Xidorn Quan, Craig Revie, Melanie Richards, Florian Rivoal, Jacob Rus, Joseph Salowey, Simon Sapin, Igor Snitkin, Lea Verou, Mark Watson, James Stuckey Weber, Sam Weinig, and Natalie Weizenbaum.

<!--
██      ██ ████████  ████████       ██     ██ ████ ████████  ████████
██  ██  ██ ██     ██    ██          ██     ██  ██  ██     ██ ██
██  ██  ██ ██     ██    ██          ██     ██  ██  ██     ██ ██
██  ██  ██ ████████     ██          █████████  ██  ██     ██ ██████
██  ██  ██ ██           ██          ██     ██  ██  ██     ██ ██
██  ██  ██ ██           ██          ██     ██  ██  ██     ██ ██
 ███  ███  ██           ██          ██     ██ ████ ████████  ████████
-->

<wpt hidden title="CSS Color 3 or 5 or 6 tests, not relevant for this level">
at-color-profile-001.html
color-mix-currentcolor-001.html
color-mix-currentcolor-002.html
color-mix-currentcolor-003.html
color-mix-basic-001.html
color-mix-non-srgb-001.html
color-mix-percents-01.html
color-mix-percents-02.html
composited-filters-under-opacity.html
light-dark-basic.html
light-dark-currentcolor.html
light-dark-inheritance.html
light-dark-currentcolor-in-color.html
t31-color-currentColor-b.xht
t31-color-text-a.xht
t41-html4-keywords-a.xht
t421-rgb-clip-outside-gamut-b.xht
t421-rgb-func-int-a.xht
t421-rgb-func-no-mixed-f.xht
t421-rgb-func-pct-a.xht
t421-rgb-func-whitespace-b.xht
t421-rgb-hex-parsing-f.xht
t421-rgb-hex3-a.xht
t421-rgb-hex3-expand-b.xht
t421-rgb-hex6-a.xht
t421-rgb-values-meaning-b.xht
t422-rgba-a0.0-a.xht
t422-rgba-a0.6-a.xht
t422-rgba-a1.0-a.xht
t422-rgba-clamping-a0.0-b.xht
t422-rgba-clamping-a1.0-b.xht
t422-rgba-clip-outside-device-gamut-b.xht
t422-rgba-func-int-a.xht
t422-rgba-func-no-mixed-f.xht
t422-rgba-func-pct-a.xht
t422-rgba-func-whitespace-b.xht
t422-rgba-values-meaning-b.xht
t423-transparent-1-a.xht
t423-transparent-2-a.xht
t424-hsl-basic-a.xht
t424-hsl-h-rotating-b.xht
t424-hsl-parsing-f.xht
t424-hsl-values-b-1.html
t424-hsl-values-b-10.html
t424-hsl-values-b-11.html
t424-hsl-values-b-12.html
t424-hsl-values-b-13.html
t424-hsl-values-b-14.html
t424-hsl-values-b-15.html
t424-hsl-values-b-2.html
t424-hsl-values-b-3.html
t424-hsl-values-b-4.html
t424-hsl-values-b-5.html
t424-hsl-values-b-6.html
t424-hsl-values-b-7.html
t424-hsl-values-b-8.html
t424-hsl-values-b-9.html
t425-hsla-basic-a.xht
t425-hsla-h-rotating-b.xht
t425-hsla-parsing-f.xht
t425-hsla-values-b.xht
t43-svg-keywords-a.xht
t44-currentcolor-background-b.xht
t44-currentcolor-border-b.xht
t44-currentcolor-inherited-c.xht
animation/color-composition.html
animation/color-interpolation.html
animation/opacity-interpolation.html
color-mix-basic-001.html
color-mix-currentcolor-visited.html
color-mix-currentcolor-visited-getcomputedstyle.html
nested-color-mix-with-currentcolor.html
relative-currentcolor-a98rgb-01.html
relative-currentcolor-displayp3-01.html
relative-currentcolor-hsl-01.html
relative-currentcolor-hsl-02.html
relative-currentcolor-hwb-01.html
relative-currentcolor-lab-01.html
relative-currentcolor-lch-01.html
relative-currentcolor-oklab-01.html
relative-currentcolor-oklch-01.html
relative-currentcolor-prophoto-01.html
relative-currentcolor-rec2020-01.html
relative-currentcolor-rec2020-02.html
relative-currentcolor-rgb-01.html
relative-currentcolor-rgb-02.html
relative-currentcolor-xyzd50-01.html
relative-currentcolor-xyzd65-01.html
relative-color-with-zoom.html
relative-color-with-system-color.html
parsing/alpha-color-computed.html
parsing/alpha-color-parsing-invalid.html
parsing/alpha-color-parsing-valid.html

parsing/color-mix-out-of-gamut.html
parsing/color-invalid.html
parsing/color-computed-color-mix-function.html
parsing/color-invalid-color-mix-function.html
parsing/color-valid-color-mix-function.html
parsing/color-computed-relative-color.html
parsing/color-invalid-relative-color.html
parsing/color-valid-relative-color.html
parsing/relative-color-out-of-gamut.html
/css/css-color/color-mix-missing-components.html

light-dark-image.html
light-dark-image-none-interpolation.html
light-dark-image-none.html

animation/contrast-color-interpolation.html
color-layers-no-blend-mode.html
parsing/color-invalid-color-layers-function.html
parsing/color-valid-color-layers-function.html
parsing/color-computed-contrast-color-function.html
parsing/color-invalid-contrast-color-function.html
parsing/color-valid-contrast-color-function.html
contrast-color-001.html
contrast-color-currentcolor-inherited.html
contrast-color-style-query.html
parsing/contrast-color-function-calc-container.html
crashtests/stop-color-invalid-rgb.html
</wpt>

<!--
 ██████  ██     ██    ███    ██    ██  ██████   ████████  ██████
██    ██ ██     ██   ██ ██   ███   ██ ██    ██  ██       ██    ██
██       ██     ██  ██   ██  ████  ██ ██        ██       ██
██       █████████ ██     ██ ██ ██ ██ ██   ████ ██████    ██████
██       ██     ██ █████████ ██  ████ ██    ██  ██             ██
██    ██ ██     ██ ██     ██ ██   ███ ██    ██  ██       ██    ██
 ██████  ██     ██ ██     ██ ██    ██  ██████   ████████  ██████
-->

<h2 id='changes' class='no-num'>
Changes</h2>

<h3 id="changes-from-20250424">Changes since the
	<a href="https://www.w3.org/TR/2025/CRD-css-color-4-20250424/">Candidate Recommendation Draft of 24 April 2025</a></h3>

<ul>
	<li>Explained color difference metrics better, and added ΔΕOKr2
		(<a href="https://github.com/w3c/csswg-drafts/issues/14207">Issue 14207</a>)
	</li>
	<li>Added Oklab a,b plane diagrams for the sRGB, display-p3, a98-rgb, prophoto-rgb,
		and rec2020 predefined color spaces, alongside the existing CIE Lab diagrams
	</li>
	<li>Avoid referencing "prepare for conversion", just state directly
		(<a href="https://github.com/w3c/csswg-drafts/issues/14049">Issue 14049</a>)
	</li>
	<li>Clarified that the computed value of a deprecated system color 
		is the color of the corresponding (non-deprecated) system color
		(<a href="https://github.com/w3c/csswg-drafts/issues/3873">Issue 3873</a>,
		<a href="https://github.com/w3c/csswg-drafts/issues/13459">Issue 13459></a>,
		<a href="https://github.com/w3c/csswg-drafts/issues/13719">Issue 13719</a>)
	</li>
	<li>Consolidated the resolution of system colors and deprecated system colors
		(<a href="https://github.com/w3c/csswg-drafts/issues/13450">Issue 13450</a>)
	</li>
	<li>Clarified carry-forward in color interpolation
		(<a href="https://github.com/w3c/csswg-drafts/issues/14134">Issue 14134</a>)
	</li>
	<!-- to 21 June 2026 -->
	<li>Split serialization of alpha values by whether legacy and modern syntax was used; require 16bit alpha
		(<a href="https://github.com/w3c/csswg-drafts/issues/13994">Issue 13994</a>)
	</li>
	<li>Consistent mention of display-p3-linear in color(...) syntax 
		(<a href="https://github.com/w3c/csswg-drafts/pull/14024">PR 14024</a>)
	</li>
	<li>
		Rework the color-scheme section to use the concepts of 'page color scheme' and 'element color scheme'
		(<a href="https://github.com/w3c/csswg-drafts/pull/13857">Issue 13857</a>)
	</li>
	<li>Pick sRGB serialization form by presence of none
		(<a href="https://github.com/w3c/csswg-drafts/issues/10254">Issue 10254</a>)
	</li>
	<li>For color comparisons in Oklab, standardized ε to be <strong>0.00001</strong>
		(<a href="https://github.com/w3c/csswg-drafts/issues/13157#issuecomment-4329625711">Issue 13157</a>)
	</li>
	<li>Added a new section defining when two <<color>> values are [=equivalent colors=],
		covering same-color-space component comparison, the treatment of [=missing component=]s,
		and cross-color-space comparison via ''oklab''.
		(<a href="https://github.com/w3c/csswg-drafts/issues/13157">Issue 13157</a>)
	</li>
	<li>Clarified in the main Color interpolation section that, if the hue interpolaton method is not specified, shorter is the default. (This was already specified in the Hue Interpolation section).
	(<a href="https://github.com/w3c/csswg-drafts/issues/13788">Issue 13788</a>)
	</li>
	 <li>Expanded the concept of analogous components to analogous sets of components, to minimize ''none'' → ''0'' conversions
		(<a href="https://github.com/w3c/csswg-drafts/issues/10210">Issue 10210</a>)
	</li>
	 <li>Split color conversion into two stages
		(<a href="https://github.com/w3c/csswg-drafts/issues/10211">Issue 10211</a>)
	 </li>
	<li>Clarified how system colors react to the used color scheme
		(<a href="https://github.com/w3c/csswg-drafts/issues/13719">Issue 13719</a>)</li>
	<li>Updated abstract to mention color interpolation and gamut mapping.</li>
	<li>Clarified wording regarding the aims of CSS gamut mapping</li>
	<li>Corrected ray trace algorithm to not overwrite <i>end</i>
		(<a href="https://github.com/w3c/csswg-drafts/issues/10579">Issue 10579</a>)
	</li>
	<li>Added pseudocode for the ray trace gamut mapping algorithm
		(<a href="https://github.com/w3c/csswg-drafts/issues/10579">Issue 10579</a>)
	</li>
	<li>Added EdgeSeeker and Ray Trace Gamut Mapping Algorithms. Allowed choice of three GMA
		(<a href="https://github.com/w3c/csswg-drafts/issues/10579">Issue 10579</a>)
	</li>
	<li>Added a diagram showing imaginary colors in CIE Lab</li>
	<li>Differentiated between out of gamut but physically realizable colors, and imaginary colors</li>
	<li>More even-handed description of clipping,
		showing some cases which give acceptable results
		(<a href="https://github.com/w3c/csswg-drafts/issues/10579">Issue 10579</a>)
	</li>
	<li>Fixed discrepency in ΔE2000 sample implementation
		(<a href="https://github.com/w3c/csswg-drafts/issues/13322">Issue 13322</a>)
	</li>
	<!-- to 11 Jan 2026 -->
	<li>Updated ''AccentColor'' to take its value from 'accent-color', unless in [=Forced Colors Mode=]
		(<a href="https://github.com/w3c/csswg-drafts/issues/5900">Issue 5900</a>)
	</li>
	<li>Defined rec2020 color space to use display-referred, 2.4 gamma
		(<a href="https://github.com/w3c/csswg-drafts/issues/12574">Issue 12574</a>)
	</li>
	<li>Added display-p3-linear to predefined colorspaces
		(<a href="https://github.com/w3c/csswg-drafts/issues/11250">Issue 11250</a>)
	</li>
	<li>Clarified serializing opacity values with calc()
		(<a href="https://github.com/w3c/csswg-drafts/issues/10426">Issue 10426</a>)
	</li>
	<li>Interpolation between legacy sRGB colors is (once again) in sRGB space, for compatibility
		(<a href="https://github.com/w3c/csswg-drafts/issues/7949">Issue 7949</a>)
	</li>
	<li>Clarified real-world CIE Lab range for a and b
		(<a href="https://github.com/w3c/csswg-drafts/issues/12208">Issue 12208</a>)
	</li>
	<li>Clarified that Opacity value does not affect hit testing
		(<a href="https://github.com/w3c/csswg-drafts/issues/11339">Issue 11339</a>)
	</li>
</ul>

<h3 id="changes-from-20240213">Changes since the <a href="https://www.w3.org/TR/2024/CRD-css-color-4-20240213/">Candidate Recommendation Draft of 13 Feb 2024</a></h3>

<ul>
	<li>Clarified that inside the color property, it is the resolved inherited value (not the raw inherited value) that is used</li>
	<li>Listed categories of colors, such as those that resolve to sRGB or support legacy color syntax</li>
	<li>Added hue normalization examples</li>
	<li>Corrected table of analogous components, alpha was missing, but described as analogous in prose</li>
	<li>Collected together and clarified serialization of opacity values into one section</li>
	<li>Clarified wording around color-interpolation-method and host syntax</li>
	<!-- to 1 Apr 2025 -->
	<li>Defined epsilon for returning missing hue</li>
	<li>Used a more precise definition of achromatic colors with missing hues (sufficiently close to the central axis)</li>
	<li>Consistently use "color component" rather than "color channel" (both were being used).</li>
	<li>Correlated Color Temperature was used without being defined or explained. Added informative reference.</li>
	<li>Exported term premultiplied, linked to it consistently</li>
	<li>Equivalence of deprecated and un-deprecated system colors is no longer at-risk</li>
	<li>Clarified intended use of the "parse a CSS <<color>>" algorithm</li>
	<li>Added corrected examples for HTML-compatible serialization</li>
	<li>Removed check on missing values for HTML-compatible serialization, they will already have been converted to zero</li>
	<li>Moved note about missing values becoming 0, so it applies to both HTML-compatible and CSS serializations</li>
	<li>Added an HTML-Compatible hex serialization for sRGB</li>
	<!-- to 21 June 2024 -->
	<li>Added another  xyz-d65 and xyz-d50 example</li>
	<li>Clarify which component (Y) in XYZ corresponds to brightness</li>
	<li>Clarified that CSS gamut mapping applies on actual, not used, values</li>
	<li>Removed hue normalization from the hslToRgb sample code, as the input is already normalized at parse time</li>
	<li>Corrected the pseudo-code for step 4 of the gamut mapping algorithm</li>
	<li>Clarified that interpolation is the most common situation which combines two colors, but not the only one. </li>
	<li>Ensured adequate contrast for text in the deltaE table</li>
	<li>Removed remaining use of the term &lt;absolute-color-function>, use &lt;absolute-color> function instead for consistency</li>
	<li>Updated acknowledgements section</li>
	<li>Added gamut mesh diagram</li>
	<li>Described CSSOM serialization in terms of declared values rather than specified values</li>
	<li>Added exported definition of luminance</li>
	<li>Added production rule for &lt;opacity-value> </li>
	<li>Clarified when results from hslToRgb will be in [0,1]</li>
	<li>Clarified that once linearized, RGB spaces are additive</li>
</ul>

<h3 id="changes-from-20221101">Changes since the
	<a href="https://www.w3.org/TR/2022/CRD-css-color-4-20221101/">Candidate Recommendation Draft of 1 November 2022</a>
</h3>

<ul>
	<!-- to 7 Feb 2024 -->
	<li>Added steps for serializing a uint8_t alpha, moved from cssom-1</li>
	<li>Restored parse-time clamping of HSL negative saturation to 0, which is current interop behavior from CSS Color 3</li>
	<li>When interpolating, always convert color space, so that powerless components become missing</li>
	<li>Clarified when alpha 1 is omitted from serialization</li>
	<li>Removed redundant constraining of hue angles to [0,360] as this is already done.</li>
	<li>Corrected description of ActiveCaption, which is a background. </li>
	<li>Disambiguated opacity and alpha. Opacity property now uses opacity-value (which has different clamping behavior to alpha-value)</li>
	<li>Clarified that carrying forward happens before premultiplication</li>
	<li>Updated gamut mapping algorithm</li>
	<li>Fixed a few issues regarding hue interpolation </li>
	<li>Clarified that HWB white or black at 100% is insufficient criterion for an achromatic color; it is the sum which matters.</li>
	<!-- to 16 Dec 2023 -->
	<li>Avoid returning negative saturation in rgb to hsl conversion; adjust the hue to point to "the other side" instead</li>
	<li>Use 64 bit accurate matrices for ProPhoto, which does not have a rational form</li>
	<li>Oklab matrices recalculated for 64bit precision (returns same results as before, at 32 bit precision)</li>
	<li>Consistently return output of GMA in the destination color space, even if no mapping is performed because the destination is unbounded</li>
	<li>Added explanation for why one JND for Oklab is 0.02, not 2 </li>
	<li>Clarified that resolving sRGB values does not apply to the color() function</li>
	<li>Moved alpha value definition up to the opacity property, clarified that opacity specified values are not clamped.</li>
	<li>System Colors now explicitly permit spoofing, to preserve privacy</li>
	<li>Corrected the inverse chromatic adaptation matrix for D50 to D65 </li>
	<li>Consistently distinguish linear Bradfrod from the original, more complicated, Bradford chromatic adaptation algorithm</li>
	<li>In the gamut mapping algorithm, return clipped as the gamut mapped result, avoiding un-necessary steps</li>
	<li>Updated chromatic adaptation matrices to higher precision</li>
	<li>Added Add 'parse a css color' algorithm, so non-CSS specs using colors don't have to reinvent the machinery here.</li>
	<li>Clarified that geometric gamut mapping must not project chroma back beyond the original color</li>
	<li>Use the term "geometric" rather than "analytical" in gamut mapping discussion</li>
	<li>Aligned prose for HSL into line with the grammar (percent and number both allowed)</li>
	<li>Fixed an LCH alpha interpolation example, which was erroneously un-premultiplying the hue angle</li>
	<li>Corrected the sRGB and display-p3 transfer function. (This only affected the result if a component had the exact value 10.31475 / 255, which is not possible at 8 or 10 bits per component)</li>
	<!-- to 26 Oct 2023 -->
	<li>Clarified that the specified values of system colors are still themselves</li>
	<li>Added mention of PNG cICP chunk for tagging images</li>
	<li>Described behaviour of hue increasing and decreasing when 0/360 is passed </li>
	<li>Aligned description of powerlessnes in HSL with the other polar color models</li>
	<li>Explicitly defined order of operations for color interpolation</li>
	<li>Added mention of degenerate numeric constants in calc()</li>
	<li>Clarified that calc() in sRGB has early resolution, and clamps the result</li>
	<li>Clarified that HWB hue has the same disadvantages as HSL hue</li>
	<li>Added luminance to lightness comparison and figure</li>
	<!-- to 6 Sept 2023 -->
	<li>Added descriptions and examples for hue interpolation keywords</li>
	<li>Use normative prose for achromatic HWB colors</li>
	<li>Corrected hue interpolation angle range; [0,360) not [0,360]</li>
	<li>Expressed that displaying as black or white when L=0% or 100% is due to gamut mapping. Removed incorrect assertions of powerlessness</li>
	<li>Dropped the confusing "representing black" and "representing white" comments</li>
	<li>Clarified that opponent a and b are analogous</li>
	<li>Specified RGB components using reference ranges rather than prose, for consistency</li>
	<li>Explicitly referenced percent reference ranges for percentage to number conversion when serializing Lab, LCH, Oklab, OkLCh</li>
	<li>Required Oklab interpolation, remove previous "may", describe explicit opt-out</li>
	<li>Labelled the Lab, LCH, Oklab and OkLCh tutorial sections as non-normative. Moved some definitions out of the non-normative section.</li>
	<li>Clarified that, when interpolating, checking for analogous components happens before color space conversion</li>
	<li>Back-ported hwb() syntax changes and reference ranges from CSS Color 5</li>
	<li>Defined carry-forward operations must happen before powerless operations</li>
	<li>Clarified it is <em>color</em> components which must be all-number or all-percentage, in legacy rgb() syntax</li>
	<!-- to 10 May 2023 -->
	<li>Clarified for legacy syntax that color components must be all-percentage or all-number</li>
	<li>Added examples of specified out of range alpha, with and without calc()</li>
	<li>Placed examples of serializing with trimmed trailing zeroes colorer to the relevant text</li>
	<li>clarified example, used value of text-shadow</li>
	<li>Clarified resolving currentColor</li>
	<li>Updated acknowledgments</li>
	<!-- to 30 Mar 2023 -->
	<li>Stop claiming that achromatic colors have missing a,b, or chroma</li>
	<li>HSL and HWB changed to unbounded gamut, to promote round-tripping</li>
	<li>Defined percentage reference range for HSL</li>
	<li>Modern color syntax hsl() and hsla() allow mixed number and percentage components</li>
	<li>Modern color syntax rgb() and rgba() allow mixed number and percentage components</li>
	<li>Define the term "modern color syntax" (legacy color syntax already defined).</li>
	<li>Consistently use the term "analogous components"</li>
	<!-- to  7 Feb 2023 -->
	<li>Changed to allow all predefined color spaces for interpolation</li>
	<li>Clarified that for color(), three parameters (RGB or XYZ) are required</li>
	<li>Clarified serialization of named colors, system colors, and transparent</li>
	<!-- to 14 Jan 2023 -->
	<li>Define specified value for Lab, LCH, Oklab, OkLCh</li>
	<li>Define specified value for other sRGB colors</li>
	<li>Define specified values for named and system colors</li>
	<li>Clamp alpha, Lightness, Chroma and Hue at parsed-value time</li>
	<li>Remove passing mention of specular white and CIE Lightness</li>
	<li>No longer require as-specified Hue to be retained; clamp to [0, 360]</li>
	<li>Consistent serialization of Lightness and number in examples</li>
	<li>Minor typos and editorial clarifications</li>
</ul>

<h3 id="changes-from-20220705">Changes since the
	<a href="https://www.w3.org/TR/2022/CR-css-color-4-20220705/">Candidate Recommendation of 5 July 2022</a>
</h3>

<ul>
	<li>Removed hue interpolation "specified" value</li>
	<li>Defined hue interpolation angle more precisely, maintaining differences of 360deg</li>
	<li>Added example of carried forward alpha for premultiplication</li>
	<!-- to 20 Oct 2022 -->
	<li>Clarified a,b and C,h powerless at L=100% representing white.</li>
	<li>Removed handwavy mention of L=400 which applies to hdr-CIELAB not CIE Lab</li>
	<!-- to 18 Oct 2022  -->
	<li>Consistent capitalization of Oklab and OkLCh</li>
	<li>Moved definitions of valid color, invalid color, out of gamut and in gamut to terminology section</li>
	<li>Fixed definition of "longer" hue interpolation</li>
	<li>Further clarified the concept of a host syntax</li>
	<li>Accessibility improvements for color swatches</li>
	<li>Made explicit that legacy forms do not support "none"</li>
	<li>Remove "none" from the hue production, as it is not allowed in legacy syntax</li>
	<li>Removed some dangling references to CMYK and CMYKOGV, moved to CSS Color5</li>
	<!-- to 1 Sept 2022 -->
	<li>Clarified how missing values in colors to be interpolated are carried forward</li>
	<li>Updated syntax of xyz-params so they take numbers and percentage, to align with prose</li>
	<li>Ensure all examples and figures have IDs, self-links</li>
	<li>Clarified importance to implementors of reading the gamut mapping introduction</li>
	<li>Removed left-over mention of custom color spaces (feature was moved to CSS Color 5)</li>
	<li>Refactor syntax of &lt;color> and &lt;alpha-value></li>
	<li>Editorial refactoring for better reading order.</li>
	<li>Updated pseudocode for gamut mapping algorithm, remove un-needed deltaE calls</li>
</ul>

<h3 id="changes-from-20220628">Changes since the
	<a href="https://www.w3.org/TR/2022/WD-css-color-4-20220628/">Working Draft of 28 June 2022</a>
</h3>
<ul>
	<li>Updated status for Candidate Recommendation</li>
</ul>

<h3 id="changes-from-20220428">Changes since the
	<a href="https://www.w3.org/TR/2022/WD-css-color-4-20220428/">Working Draft of 28 April 2022</a>
</h3>

<ul>
	<!-- to 21 June 2022 -->
	<li>Moved opacity property up to the top of the module, next to color property, before getting into details.</li>
	<li>Improved description of the color property, in particular effect on other properties</li>
	<li>Corrected longer hue adjust equation, for equal-modulo-360 colors</li>
	<li>Added two new System colors: AccentColor and AccentColorText
	<li>Described overall color space conversion steps in new section</li>
	<!-- to 5 May 2022 -->
	<li>Accounted for ''none'' alpha in premultiplication and un-premultiplication</li>
</ul>

<h3 id="changes-from-20211215">Changes since the
	<a href="https://www.w3.org/TR/2021/WD-css-color-4-20211215/">Working Draft of 15 December 2021</a>
</h3>

<ul>
	<!-- to 20 Apr 2022 -->
	<li>Made system colors fully resolve, but forbid their alteration in forced colors mode</li>
	<li>Removed forgiveness for incorrect number of parameters in color() function</li>
	<!-- to 27 Feb 2022 -->
	<li>Changed serialization of CIE Lightness and OK Lightness to number rather than percentage.</li>
	<li>Marked deprecated system color equivalences as at-risk</li>
	<li>Added reference ranges to percentage values for CIE and OK L,a,b,C</li>
	<li>Noted that there is sample code for performing and undoing premultiplication, for both rectangular and polar color spaces.</li>
	<li>Added out of range clamping to the gamut mapping prose, as well as the pseudocode</li>
	<li>Added normative reference for ProPhoto RGB / ROMM</li>
	<li>Corrected sRGB and Display P3 black point value for reference surround</li>
	<li>Added normative reference for Display P3</li>
	<!-- To 05 Feb 2022 -->
	<li>Avoided an infinite loop in gamut reduction, with colors whiter than white or darker than black</li>
	<li>Clarified serialization of the ''none'' value</li>
	<li>Clarified the opt-in to interpolation in Oklab, for non-legacy colors</li>
	<li>Defined how premultiplication works, with the ''none'' value</li>
	<li>Clarified that missing values in rgb serialize as 0</li>
	<li>Clarified the use of calc() with the ''none'' value</li>
	<li>Typo, inconsistent casing on System Colors</li>
	<li>Added example of SelectedItem with SelectedItemText</li>
	<li>Explicitly noted the presence or absence of legacy colors</li>
	<li>Added normative reference for CIE XYZ</li>
	<li>Added normative reference for HWB and HSL</li>
	<li>Clarified that ''hwb()'' is not a legacy syntax so does not support the older, comma-separated syntactic form</li>
	<li>Clarified that only legacy colors will gamut map, the others are unbounded</li>
	<li>Use distinct terms, spectrophotometer and spectroradiometer</li>
	<li>Assorted minor typos fixed, and grammatical improvements</li>
</ul>

<h3 id="changes-from-20210601" class="no-num">Changes since the
	<a href="https://www.w3.org/TR/2021/WD-css-color-4-20210601/">Working Draft of 1 June 2021</a>
</h3>

<ul>
	<li>Added gamut mapping section and defined a CSS gamut mapping algorithm as chroma reduction in OkLCh with local MINDE.</li>
	<li>Computed value of color(xyz ...) is color(xyz-d65 ...)</li>
	<li>Added srgb-linear to interpolation color spaces</li>
	<li>Updated Changes from Colors 3 section</li>
	<li>Added Resolving Oklab and OkLCh values section</li>
	<!-- to 19 Nov 2021 -->
	<li>Added srgb-linear color space</li>
	<li>Moved @color-profile and device-cmyk to level 5 per CSSWG resolution</li>
	<li>Defined interpolation color space</li>
	<!-- to Oct 30 2021 -->
	<li>Clarified that matrices are row-major and linked to the matrix multiplication library</li>
	<li>Split old Security & Privacy section into separate sections</li>
	<!-- to Oct 16 2021-->
	<li>Defined quirks-mode quirky hex colors</li>
	<li>Removed fallback colors from device-cmyk</li>
	<li>Host syntax that does not declare a default now uses Oklab by default</li>
	<li>Added sample code for deltaE OK</li>
	<li>Added sample conversion code for OKlab and OkLCh</li>
	<li>Added oklab() and oklch() functions</li>
	<i>Added description of Oklab and OkLCh</i>
	<li>Added description of CIE LCH deficiencies</li>
	<li>Allowed all components of a color to be "missing" via the ''none'' keyword,
		defined when components are "powerless" and automatically become missing in some cases,
		and fixed all references to "NaN" components to use the "missing" concept.</li>
	<li>Defined explicit x,y whitepoint values, use consistently throughout</li>
	<li>Defined the term host syntax</li>
	<li>Defined context for resolving override-color colors</li>
	<li>Added a new pair of system colors</li>
	<li>Corrected HSL and HWB sample code</li>
	<li>Replaced table of HSL values with error-free version</li>
	<!-- to 9 July 2021 -->
	<li>Added Lea Verou as co-editor by WG resolution</li>
	<li>Clarified that hue angle is unbounded</li>
	<li>MarkText example corrected</li>
	<li>Added diagrams, corrected examples</li>
	<li>Some editorial clarifications</li>
	<li>Minor typos corrected, markup corrections</li>
</ul>

<h3 id="changes-from-20201112" class="no-num">Changes since the
	<a href="https://www.w3.org/TR/2020/WD-css-color-4-20201112/">Working Draft of 12 November 2020</a>
</h3>

<ul>
	<li>Noted indeterminate hue ssue on near-neutral Lab values converted to LCH</li>
	<li>Clarified which steps are linear combinations in RGB Lab interconversion</li>
	<!-- to 20 May 2021 -->
	<li>Added components descriptor to @color-profile, for use in CSS Color 5</li>
	<li>All predefined RGB color spaces are defined over the extended range</li>
	<li>Clarified that there is no gamut mapping or gamut clipping step prior to color interpolation</li>
	<li>Clarified interpolation of legacy sRGB syntaxes</li>
	<li>Removed the lab option from ''color()''</li>
	<li>List steps to interconvert between predefined color spaces</li>
	<li>Consistent use of the term color space (two words)</li>
	<li>Provided more guidance on selecting color space for mixing </li>
	<li>Recalculated an example to increase precision</li>
	<li>Added hue interpolation example</li>
	<li>Simplified ''color()'' syntax by removing the fallback options</li>
	<li>Clarified the types of ICC profile that may be linked from @color-profile</li>
	<li>Support for the rare ICC Named Colors was removed</li>
	<li>Improved precision of standard whitepoint chromaticities</li>
	<li>Removed a trademark from description of one predefined color space</li>
	<li>Rephrased interpolation to be more generic wrt to interpolation space</li>
	<li>Corrected Accessibility Considerations section</li>
	<li>Clarified that the color space argument for ''color()'' is mandatory, even for sRGB</li>
	<li>Clarified that currentColor is not restricted to sRGB</li>
	<!-- to 3 Feb 2021 -->
	<li>Small correction to the sRGB to XYZ to sRGB matrices, improve round-tripping</li>
	<li>Clarified the rec2020 transfer function, citing the correct ITU Rec BT.2020-2 reference</li>
	<li>Correct fallback examples to use the correct syntax</li>
	<li>Don't force non-legacy colors to interpolate in a gamma-encoded space</li>

	<!-- Changes for Interpolation section, moved from Color 5 -->
	<li>Define premultiplied alpha interpolation</li>
	<li>Start to address interpolation to and from currentColor</li>
	<li>Define hue interpolation with NaN</li>
	<li>Generalize color interpolation</li>
	<li>Define interpolation to be in Lab, with override to LCG</li>
	<li>Corrections to hue interpolation</li>
	<li>Defined hue angle interpolation</li>
	<li>Added interpolation section</li>

	<!-- to 25 Jan 2021-->
	<li>Corrected syntax in some examples</li>
	<li>Clarify exactly which components are allowed percentages, in ''color()''</li>
	<li>Change to serialize ''lch()'' as itself rather than as ''lab()''</li>
	<li>Minimum 10 bits per component precision for non-legacy sRGB in ''color()''</li>
	<li>color space no longer optional in ''color()'' </li>
	<li>Consistent minimum precision between lab() and color(lab)</li>

	<!-- to 18 Jan 2021 -->
	<li>Clarified fallback procedure for the color() function – first valid in-gamut color, else first valid color which is then gamut mapped, else transparent black</li>
	<li>Clarified difference between opacity property and colors with opacity, notably for rendering overlapping text glyphs</li>
	<li>Added sample (but verified correct) code for ΔE2000</li>
	<li>Added definition of previously-undefined term chromaticity, with examples; define chromaticity diagram.</li>
	<li>Added explanation of color additivity, with examples</li>
	<li>Added source links to WPT tests</li>
	<li>Export definition of color, and valid color, for other specifications to reference</li>
	<li>Define minimum number of bits per component, for serialization</li>
	<li>Updated "applies to" definitions (CSS-wide change)</li>
	<li>Added image state (display referred or scene referred) for predefined color spaces</li>
	<li>Listed white point correlated color temperature (e.g. D65) alongside chromaticity coordinates, for clarity</li>
	<li>Clarified that rounding is towards +∞</li>
	<li>Correction of typos, markup corrections, link fixes</li>
</ul>

<h3 id="changes-from-20191105" class="no-num">Changes since
<a href="https://www.w3.org/TR/2019/WD-css-color-4-20191105/">Working Draft of
5 November 2019</a></h3>

<ul>
	<!-- changes to Nov 3	-->
	<li>Export some terms for use in other specifications</li>
	<li>Update requirement from WCAG 2.0 to 2.1</li>
	<li>Fully specify Unicode characters used for serialization</li>
	<li>Define serialization of special named colors</li>
	<li>Define serialization of device-cmyk()</li>
	<li>Define serialization of ''color()''</li>
	<li>Fully define RGB serialization, in maximally web-compatible way</li>
	<li>Define serialization of Lab and LCH</li>
	<li>Fully define serialization of alpha values</li>
	<li>Consistency pass to avoid accidental RFC2119</li>
	<li>Add IDs to all the examples, to enable referencing</li>
	<li>Separate resolved color and serialized color sections</li>
	<li>(Security) ICC profiles have no executable code</li>
	<li>Define what out-of-range means for profiled colors</li>
	<li>Clarify out-of-range clamping</li>
	<li>Add examples of specified values</li>
	<li>Clarify computed values</li>
	<li>Resist fingerprinting, with mandatory mappings for deprecated system colors</li>
	<!-- changes to Oct 21 -->
	<li>Added explanatory note on history and reason for standardizing X11 colors</li>
	<li>Correct hwb sample code</li>
	<li>Add table of DeltaE2000 values for MacBeth patches</li>
	<li>Add note on ICC profile Internet Media type</li>
	<li>Add reference to PNG sRGB chunk</li>
	<li>Clarify CMYK to Lab interconversion</li>
	<li>Clarify RGB to Lab interconversion</li>
	<li>More comparison of HSL vs. LCH</li>
	<li>More description for Rec BT.2020 color space</li>
	<li>Updated description of prophoto-rgb</li>
	<li>Removed duplicate "keywords" from Value Definitions section </li>
	<li>Added an example of an invalid color</li>
	<li>Added example with multiple fallbacks</li>
	<li>Assorted typos and markup fixes</li>
	<li>Clarify handling for undeclared custom color spaces</li>
	<li>Clarify some examples and explanatory notes</li>
	<li>Handling for valid and invalid ICC profiles</li>
	<li>Define handling for images with explicit tagged color space</li>
	<li>Define color space for 4k, SDR video</li>
	<li>State that user contrast settings mst take precedence</li>
	<li>Clarify meaning of system colors outside for forced-color mode</li>
	<li>Update default style rules</li>
	<li>Add CIE XYZ color space to ''color()''</li>
	<li>Greater clarity on hue angles, NaN explicitly allowed</li>
	<li>Improve section on system color pairings, require AA accessible contrast</li>
	<li>Warn of interaction between overlapping glyphs and the opacity property</li>
	<li>Correct grammar in color definition</li>
	<li>Improve description of Highlight/HighlightText</li>
	<li>Correct prophoto-rgb transfer function</li>
	<li>More precision for prophoto-rgb primaries</li>
	<li>Started to define "can't be displayed"</li>
	<li>Removed paragraph about canvas surface</li>
	<li>Added the buttonborder, mark, and marktext system colors</li>
	<li>Added reverse conversion, sRGB to HWB</li>
	<li>Clarified polar spaces are cylindrical, not spherical</li>
	<li>Added an Accessibility Considerations section</li>
	<li>Started to describe chroma-reduction gamut mapping rather than per-component clipping</li>
	<li>Corrected white chromaticity for rec2020</li>
	<li>Made device-cmyk available by @color-profile; updated CMYK to color algorithm to only use naive conversion as a last resort</li>
	<li>Added print-oriented CMYK and KCMYOGV examples</li>
	<li>User-defined color spaces now dashed-ident, making predefined color spaces extensible without clashes</li>
	<li>Added lab option to the color() function</li>
	<li>Added normative reference for CIE Lab</li>
	<li>Clarified that prophoto-rgb uses [=D50=] whitepoint so does not require adaptation</li>
	<li>Clarified direction of increasing angle in LCH</li>
	<li>Clarified that color names are ASCII case insensitive</li>
	<li>Initial value of the "color" property is now CanvasText</li>
	<li>Removed confusing gray() function per CSS WG resolution</li>
	<li>Collect scattered definitions into new
		<a href="#terminology">Color terminology</a> section</li>
	<li>Add helpful figures and more examples</li>
	<li>Minor editorial clarifications, spell check, fixing typos, bikeshed markup fixes</li>
</ul>

<h3 id="changes-from-20160705" class='no-num'>Changes since <a href="http://www.w3.org/TR/2016/WD-css-color-4-20160705/">Working Draft of 05 July 2016</a></h3>

<ul>
	<li>Changed Lightness in Lab and LCH to be a percentage, for CSS compatibility</li>
	<li>Clamping of color values clarified</li>
	<li>Percentage opacity is now allowed</li>
	<li>Define terms sRGB and linear-light sRGB, for use by other specs</li>
	<li>Add new list of CSS system colors; renaming Text to CanvasText</li>
	<li>Make system color keywords compute to themselves</li>
	<li>Add computed/used entry for system colors</li>
	<li>Rewrite intro to non-deprecated system colors to center their use around forced-colors mode rather than generic use</li>
	<li>Consistent hyphenation of predefined color spaces</li>
	<li>Restore text about non-opaque elements painting at layers even when not positioned</li>

	<li>Initial value of the "color" property is now black</li>
	<li>Clarify hue in LCH is modulo 360deg (change now reverted)</li>
	<li>Clarify allowed range of L in LCH and Lab, and meaning of L=100</li>
	<li>Update references for color spaces used in video</li>
	<li>Add prophoto-rgb predefined color space</li>
	<li>Correct black and white luminance levels for display-p3</li>
	<li>Clarify display-p3 transfer function</li>
	<li>Add a98-rgb color space, correct table of primary chromaticities</li>
	<li>Clarify that currentColor's computed value is not the resolved color</li>
	<li>Update syntax is examples to conform to latest specification</li>
	<li>Remove the color-mod() function</li>
	<li>Drop the "media" from propdef tables</li>
	<li>Export, and consistently use, "transparent black" and "opaque black"</li>
	<li>Clarify calculated values such as percents</li>
	<li>Clarify required precision and rounding behavior for color components</li>
	<li>Clarify "color" property has no effect on color font glyphs (unless specifically referenced, e.g. with currentColor)</li>
	<li>Clarify how color values are resolved</li>
	<li>Clarify that HSL, HWB and named colors resolve to sRGB</li>
	<li>Simplify conversion from device-cmyk to sRGB</li>
	<li>Describe previous, comma-using color syntaxes as "legacy"; change examples to commaless form</li>
	<li>Remove superfluous requirement that displayed colors be restricted to device gamut (like there was any other option!)</li>
	<li>Rename P3 to display-p3; avoid claiming this is DCI P3, as these are not the same</li>
	<li>Improved description of the parameters to the "color()" function</li>
	<li>Disallow predefined spaces from "@color-profile" identifier</li>
	<li>Add canonical order to "color", "color-adjust" and "opacity" property definitions</li>
	<li>Switch definition of alpha compositing from SVG11 to CSS Compositing</li>
	<li>Clarify sample conversion code is non-normative</li>
	<li>Add Security and Privacy Considerations</li>
	<li>Update several references to most current versions</li>
	<li>Convert inline issues to links to GitHub issues</li>
	<li>Minor editorial clarifications, formatting and markup improvements</li>
</ul>

<h3 id='changes-from-3'>
Changes from Colors 3</h3>

	The primary change, compared to CSS Color 3,
	is that CSS colors are no longer restricted to the
	narrow gamut of sRGB.

	To support this, several brand new features have been added:

	<ol>
		<li>predefined, wide color gamut RGB color spaces</li>

		<li>''lab()'', ''lch()'', ''oklab()'' and ''oklch()'' functions, for device-independent color

	</ol>

	Other technical changes:

	<ol>
		<li>Serialization of <<color>> is now specified here, rather than in the CSS Object Model

		<li>''hwb()'' function, for specifying sRGB colors in the HWB notation.

		<li>Addition of named color ''rebeccapurple''.
	</ol>

	In addition, there have been some syntactic changes:

	<ol>
		<li>''rgb()'' and ''rgba()'' functions now accept <<number>> rather than <<integer>>.

		<li>''hsl()'' and ''hsla()'' functions now accept <<angle>> as well as <<number>> for hues.

		<li>''rgb()'' and ''rgba()'', and ''hsl()'' and ''hsla()'' are now aliases of each other
			(all of them have an optional alpha).

		<li>''rgb()'', ''rgba()'', ''hsl()'', and ''hsla()'' have all gained a new syntax
			consisting of space-separated arguments
			and an optional slash-separated opacity.
			All the color functions use this syntax form now,
			in keeping with <a href="https://wiki.csswg.org/ideas/functional-notation#general-principles">CSS's functional-notation design principles</a>.

		<li>All uses of <<alpha-value>> now accept <<percentage>> as well as <<number>>.

		<li>4 and 8-digit hex colors have been added, to specify transparency.

		<li>The ''none'' value has been added, to represent powerless components.
	</ol>

<!--
 ██████  ████████  ██████  ██     ██ ████████  ████ ████████ ██    ██
██    ██ ██       ██    ██ ██     ██ ██     ██  ██     ██     ██  ██
██       ██       ██       ██     ██ ██     ██  ██     ██      ████
 ██████  ██████   ██       ██     ██ ████████   ██     ██       ██
      ██ ██       ██       ██     ██ ██   ██    ██     ██       ██
██    ██ ██       ██    ██ ██     ██ ██    ██   ██     ██       ██
 ██████  ████████  ██████   ███████  ██     ██ ████    ██       ██
-->

Security Considerations {#security}
===================================

The system colors,
if they actually correspond to the user's system colors,
pose a security risk,
as they make it easier for a malware site
to create user interfaces that appear to be from the system.
However, as several system colors are now defined to be "generic",
this risk is believed to be mitigated.

<!--
████████  ████████  ████ ██     ██    ███     ██████  ██    ██
██     ██ ██     ██  ██  ██     ██   ██ ██   ██    ██  ██  ██
██     ██ ██     ██  ██  ██     ██  ██   ██  ██         ████
████████  ████████   ██  ██     ██ ██     ██ ██          ██
██        ██   ██    ██   ██   ██  █████████ ██          ██
██        ██    ██   ██    ██ ██   ██     ██ ██    ██    ██
██        ██     ██ ████    ███    ██     ██  ██████     ██
-->

Privacy Considerations {#privacy}
===================================

This specification defines "system" colors,
which theoretically can expose details of the user's OS settings,
which is a fingerprinting risk.

<!--
   ███       ██      ██   ██    ██
  ██ ██    ████    ████    ██  ██
 ██   ██     ██      ██     ████
██     ██    ██      ██      ██
█████████    ██      ██      ██
██     ██    ██      ██      ██
██     ██  ██████  ██████    ██
-->


Accessibility Considerations {#a11y-sec}
========================================

This specification <a href="#accessibility">encourages authors to not use
	color alone</a> as a distinguishing feature.

This specification <a href="#css-system-colors">encourages browsers to ensure
	adequate contrast for specific system color foreground/background pairs</a>.
	A harder requirement with specific AA or AAA contrast ratios was considered,
	but since browsers are often just passing along color choices made by the OS,
	or selected by users (who may have particular requirements,
	including lower contrast for people living with migraines or epileptic seizures), the CSSWG
	was unable to require a specific contrast level.
