Skip to content

Commit 5eb3a10

Browse files
committed
[css-color] relative color syntax, components descriptor
1 parent e7b5469 commit 5eb3a10

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

css-color-4/Overview.bs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,6 +3824,39 @@ Specifying a color profile: the ''@color-profile'' at-rule</h3>
38243824
but fall just inside the gamut.
38253825
</dl>
38263826

3827+
<pre class=descdef for="@color-profile">
3828+
Name: components
3829+
Value: <<ident>>#
3830+
For: @color-profile
3831+
Initial: n/a
3832+
</pre>
3833+
3834+
Color profiles can define color spaces which contain a varying number of components.
3835+
For example, a Cyan, Magenta, Yellow and Black (CMYK) profile
3836+
has four components
3837+
named c, m, y and k
3838+
While a four-component additive screen profile
3839+
might use four components
3840+
named r, g, y and b.
3841+
3842+
The value of this descriptor is a comma-separated list of <<ident>> tokens.
3843+
Each <<ident>>> names a component,
3844+
in the order in which they are used in the color profile,
3845+
while the total number of tokens defines the number of components.
3846+
3847+
<div class="example" id="ex-components-cmyk">
3848+
This descriptor declares that there are four components named cyan, magenta, yellow and black:
3849+
<pre>components: cyan, magenta, yellow, black</pre>
3850+
while this descriptor opts for terser names:
3851+
<pre>components: c,m,y,k</pre>
3852+
</div>
3853+
3854+
<div class="example" id="ex-components-cmykogv">
3855+
This descriptor declares that there are seven components
3856+
named cyan, magenta, yellow, black, orange, green and violet:
3857+
<pre>components: cyan, magenta, yellow, black, orange, green, violet</pre>
3858+
</div>
3859+
38273860
<h3 id="cal-cmyk">
38283861
CSS and print: using calibrated CMYK and other printed color spaces</h3>
38293862

css-color-5/Overview.bs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,43 @@ the allowed [=channel keywords=] are:
10541054
</pre>
10551055
</div>
10561056

1057+
<h4 id="relative-color">Relative color-function colors</h4>
1058+
1059+
The grammar of the ''color()'' function is extended as follows:
1060+
1061+
<pre class='prod'>
1062+
<dfn>color()</dfn> = color( [from <<color>>]? <<colorspace-params>> [ / <<alpha-value>> ]? )
1063+
<dfn>colorspace-params</dfn> = [<<custom-params>> | <<predefined-rgb-params>> | <<xyz-params>>]
1064+
<dfn>custom-params</dfn> = <<dashed-ident>> [ <<number>> | <<percentage>> ]#
1065+
<dfn>predefined-rgb-params</dfn> = <<predefined-rgb>> [ <<number>> | <<percentage>> ]{3}
1066+
<dfn>predefined-rgb</dfn> = srgb | display-p3 | a98-rgb | prophoto-rgb | rec2020
1067+
<dfn>xyz-params</dfn> = xyz <<number>>{3}
1068+
</pre>
1069+
1070+
Within a [=relative color=] syntax ''color()'' function using <<custom-params>>,
1071+
the number and name of the allowed [=channel keywords=] are defined by the
1072+
'@color-profile/components' descriptor on the corresponding ''@color-profile'',
1073+
if present;
1074+
otherwise, no relative color manipulation is valid.
1075+
1076+
They are all <<percentage>>s that correspond to the [=origin color's=] channels
1077+
after its conversion to the color space of the color profile.
1078+
1079+
Within a [=relative color=] syntax ''color()'' function using <<predefined-rgb-params>>,
1080+
the allowed [=channel keywords=] are:
1081+
1082+
* <dfn value for="color()">r</dfn>, <dfn value for="color()">g</dfn>, and <dfn value for="color()">b</dfn>
1083+
are all <<percentage>>s
1084+
that correspond to the [=origin color's=] red, green, and blue channels
1085+
after its conversion to the predefined RGB color space.
1086+
1087+
Within a [=relative color=] syntax ''color()'' function using <<xyz-params>>,
1088+
the allowed [=channel keywords=] are:
1089+
1090+
* <dfn value for="color()">x</dfn>, <dfn value for="color()">x</dfn>, <dfn value for="color()">x</dfn> are all <<number>>s
1091+
that correspond to the [=origin color's=] X, Y and Z channels
1092+
after its conversion to relative, D50-adapted CIE XYZ color space.
1093+
10571094

10581095

10591096
Security and Privacy Considerations {#priv-sec}

0 commit comments

Comments
 (0)