@@ -614,89 +614,154 @@ Transparency: the 'opacity' property</h2>
614614<h2 id='color-type'>
615615Representing Colors: the <<color>> type</h2>
616616
617- CSS has several syntaxes for specifying color values.
618- Some directly specify an sRGB color by its channels,
619- such as the [=hex color notation=] or ''rgb()'' function.
620- Others are more human-friendly to write and understand,
621- such as the ''hsl()'' and ''lch()'' functions,
622- or the long list of [=named colors=] .
623617
624- <h3 id="color-syntax">The <<color>> syntax</h3>
625-
626- Colors are represented as a list of components,
618+ Colors in CSS are represented as a list of color components,
627619 also sometimes called “channels”,
628620 representing axises in the color space.
629621 Each channel has a minimum and maximum value,
630622 and can take any value between those two.
631623 Additionally, every color is accompanied by
632624 an <dfn lt="alpha channel | alpha component" export>alpha component</dfn> ,
633625 indicating how transparent it is,
634- and thus how much of the backdrop one can see behind the color.
626+ and thus how much of the backdrop one can see through the color.
627+
628+ CSS has several syntaxes for specifying color values:
629+ * the sRGB [=hex color notation=]
630+ which represents the RGB and alpha channels in hexadecimal notation
631+ * the various [=color functions=]
632+ which can represent colors using a variety of color spaces and coordinate systems
633+ * the constant [=named color=] keywords
634+ * the variable <<system-color>> keywords and ''currentColor'' keyword.
635+
636+ The <dfn>color functions</dfn>
637+ use CSS [=functional notation=]
638+ to represent colors in a variety of [=color spaces=]
639+ by specifying their channel coordinates.
640+ Some of these use a <dfn export>cylindrical polar color</dfn> model,
641+ specifying color by a <<hue>> angle,
642+ a central axis representing lightness
643+ (black-to-white),
644+ and a radius representing saturation or chroma
645+ (how far the color is from a neutral grey).
646+ The others use a <dfn export>rectangular orthogonal color</dfn> model,
647+ specifying color using three
648+ (or more, in the case of CMYK or CMYKOGV)
649+ orthogonal component axes.
650+
651+ The [=color functions=] available in Level 4 are
652+ * ''rgb()'' and its ''rgba()'' alias,
653+ which (like the [=hex color notation=] ) specify sRGB colors directly
654+ by their red/green/blue/alpha chanels.
655+ * ''hsl()'' and its ''hsla()'' alias,
656+ which specify sRGB colors
657+ by hue, saturation, and lightness
658+ using the [[#the-hsl-notation|HSL]] cylindrical coordinate model.
659+ * ''hwb()'' ,
660+ which specifies an sRGB color
661+ by hue, whiteness, and blackness
662+ using the [[#the-hwb-notation|HWB]] cylindrical coordinate model.
663+ * ''lab()'' ,
664+ which specifies a CIELAB color
665+ by CIE Lightness and its a- and b-axis hue coordinates
666+ (red/green-ness, and yellow/blue-ness)
667+ using the [[#cie-lab|CIE LAB rectangular coordinate model]] .
668+ * ''lch()'' ,
669+ which specifies a CIELAB color
670+ by CIE Lightness, Chroma, and hue
671+ using the [[#cie-lab|CIE LCH cylindrical coordinate model]]
672+ * ''oklab()'' ,
673+ which specifies an OKLAB color
674+ by OKLAB Lightness and its a- and b-axis hue coordinates
675+ (red/green-ness, and yellow/blue-ness)
676+ using the [[#ok-lab|OKLAB]] rectangular coordinate model.
677+ * ''oklch()'' ,
678+ which specifies an OKLAB color
679+ by OKLAB Lightness, Chroma, and hue
680+ using the [[#ok-lab|OKLCH]] cylindrical coordinate model.
681+ <!--
682+ * ''device-cmyk()'' ,
683+ which specifies a device-specific CMYK color
684+ by its cyan, magenta, yellow, and black components.
685+ -->
686+ * ''color()'' ,
687+ which allows specifying colors in a variety of color spaces
688+ including
689+ [[#predefined-sRGB|sRGB]] ,
690+ [[#predefined-sRGB-linear|Linear-light sRGB]] ,
691+ [[#predefined-display-p3|Display P3]] ,
692+ [[#predefined-a98-rgb|A98 RGB]] ,
693+ [[#predefined-prophoto-rgb|ProPhoto RGB]] ,
694+ [[#predefined-rec2020|ITU-R BT.2020-2]] ,
695+ and
696+ [[#predefined-xyz|CIE XYZ]] .
697+
698+ For easy reference in other specifications,
699+ <dfn export>opaque black</dfn> is defined as the color <nobr> ''rgb(0 0 0 / 100%)'' </nobr> ;
700+ <dfn export>transparent black</dfn> is the same color,
701+ but fully transparent--
702+ i.e. <nobr> ''rgb(0 0 0 / 0%)'' </nobr> .
703+
704+ <h3 id="color-syntax">The <<color>> syntax</h3>
635705
636706 Colors in CSS are represented by the <dfn export><<color>></dfn> type:
637707
638708 <pre class='prod'>
639- <color> = <<absolute-color-base>> | currentcolor | <<system-color>> | <<device-cmyk()>>
709+ <color> = <<absolute-color-base>> | currentcolor | <<system-color>> <!-- | <<device-cmyk()>> -- >
640710
641- <dfn><absolute-color-base></dfn> = <<hex-color>> | <<named -color>> | transparent |
642- <<rgb()>> | <<rgba()>> | <<hsl ()>> | <<hsla()>> | <<hwb ()>> |
643- <<lab ()>> | <<lch ()>> |
644- <<oklab()>> | <<oklch()>> |
645- <<color()>>
711+ <dfn><absolute-color-base></dfn> = <<hex-color>> | <<absolute -color-function >> | <<named-color>> | transparent
712+ <dfn><absolute-color-function></dfn> = <<rgb ()>> | <<rgba ()>> |
713+ <<hsl ()>> | <<hsla()>> | <<hwb ()>> |
714+ <<lab()>> | <<lch()>> | <<oklab()>> | <<oklch()>> |
715+ <<color()>>
646716 </pre>
647717
648- The <dfn export>color-functions</dfn> are <<rgb()>> , <<rgba()>> ,
649- <<hsl()>> , <<hsla()>> , <<hwb()>> ,
650- <<lab()>> , <<lch()>> ,
651- <<oklab()>> , <<oklch()>> , and
652- <<color()>> .
653-
654- Of those, <<hsl()>> , <<hsla()>> , <<hwb()>> , <<lch()>> , and <<oklch()>>
655- are <dfn export>cylindrical polar color</dfn> representations,
656- which specify color using a <<hue>> angle,
657- a central axis representing lightness
658- (black-to-white),
659- and a radius representing saturation or chroma
660- (how far the color is from a neutral grey).
661- The other color spaces are
662- <dfn export>rectangular orthogonal color</dfn> representations,
663- which specify color using three
664- (or more, in the case of CMYK or CMYKOGV)
665- orthogonal component axes.
666-
667- For easy reference in other specifications,
668- <dfn export>opaque black</dfn> is defined as the color <nobr> ''rgb(0 0 0 / 100%)'' </nobr> ;
669- <dfn export>transparent black</dfn> is the same color,
670- but fully transparent--
671- i.e. <nobr> ''rgb(0 0 0 / 0%)'' </nobr> .
718+ The <<hsl()>> , <<hsla()>> , <<hwb()>> , <<lch()>> , and <<oklch()>> [=color functions=]
719+ are [=cylindrical polar color=] representations using a <<hue>> angle;
720+ the other [=color functions=] use [=rectangular orthogonal color=] representations.
672721
673- All of the <<color>> syntactic forms
722+ All of the <<absolute- color-function >> syntactic forms
674723 defined in this specification
675724 use space, not comma,
676725 to separate the color components.
677726 They also use a solidus ("/")
678727 to separate an optional alpha term
679728 from the color components.
680729
730+ <div class=example id="example-generic-syntax">
731+ <p> The following represents a saturated sRGB red that is 50% opaque:
732+ <pre> rgb(100% 0% 0% / 50%)</pre>
733+ </div>
734+
735+ <h4 id="color-syntax-legacy">
736+ Legacy Comma-separated Color Function Syntax</h4>
737+
681738 For Web compatibility,
682- <<color>> syntactic forms
683- defined in earlier levels of this specification
684- also support
739+ the syntactic forms
740+ of ''rgb()'' , ''rgba()'' , ''hsl()'' , and ''hsla()'' ,
741+ <!-- of ''rgb()'' , ''rgba()'' , ''hsl()'' , ''hsla()'' , and ''device-cmyk()'' -->
742+ (those defined in earlier specifications)
743+ also support a
685744 <dfn export>legacy color syntax</dfn>
686745 which has the following differences:
687746
688- * color components are separated by comma-whitespace
747+ * color components are separated by commas
748+ (optionally preceded and/or followed by whitespace)
689749 * non-opaque forms use a separate notation
690- (for example ''hsla()'' rather than ''hsl()'' )
750+ (for example ''hsla()'' rather than ''hsl()'' )
691751 * minimum required precision is lower, 8 bits per component
692752
693- For the syntactic forms introduced
753+ <div class=example id="example-rgba-legacy"p>
754+ <p> The following represents a saturated sRGB red that is 50% opaque:
755+ <pre> rgba(100%, 0%, 0%, 0.5)</pre>
756+ </div>
757+
758+ For the [=color functions=] introduced
694759 in this or subsequent levels,
695760 where there is no Web compatibility issue,
696- <a>legacy color syntax</a> is not supported,
697- and attempting to use it is an error.
761+ the <a>legacy color syntax</a> is invalid.
698762
699- <h3 id="hue-syntax">The <<hue>> syntax</h3>
763+ <h3 id="hue-syntax">
764+ Representing Cylindrical-coordinate Hues: the <<hue>> syntax</h3>
700765
701766Hue is represented as an angle of the color circle
702767(the rainbow, twisted around into a circle, and with purple added between violet and red).
@@ -716,7 +781,7 @@ Certain operations,
716781such as hue interpolation,
717782may normalize the hue angle during calculations.
718783
719- The angles and spacing
784+ Note: The angles and spacing
720785corresponding to particular hues
721786depend on the color space.
722787For example, in HSL and HWB, which use the sRGB color space,
@@ -1604,9 +1669,9 @@ sRGB Colors</h2>
16041669
16051670 CSS provides several methods of directly specifying an sRGB color:
16061671 [=hex colors=] ,
1607- ''rgb()'' /''rgba()'' [=color- functions=] ,
1608- ''hsl()'' /''hsla()'' [=color- functions=] ,
1609- ''hwb()'' [=color-functions|color- function=] ,
1672+ ''rgb()'' /''rgba()'' [=color functions=] ,
1673+ ''hsl()'' /''hsla()'' [=color functions=] ,
1674+ ''hwb()'' [=color function=] ,
16101675 [=named colors=] ,
16111676 and the ''transparent'' keyword.
16121677
0 commit comments