Skip to content

Commit dfeed5f

Browse files
committed
[css-color-hdr] Added color function grammar, extending CSS Color 5
1 parent a65a929 commit dfeed5f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

css-color-hdr/Overview.bs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,42 @@ Mixing Dynamic Range Limits: the ''dynamic-range-limit-mix()'' function {#dynami
243243

244244
Percentages are normalized in the same way as ''color-mix()''.
245245

246+
<h2 id="color-function">
247+
Specifying Predefined and Custom Color Spaces: the ''color()'' Function
248+
</h2>
249+
250+
The ''color()'' function allows a color to be specified
251+
in a particular, given [=color space=]
252+
(rather than the implicit sRGB color space that most of the other color functions operate in).
253+
254+
In this specification the ''color()'' function is extended
255+
to allow <a href="#predefined-HDR">predefined color spaces for HDR</a>,
256+
in addition to the predefined SDR spaces from [[css-color-4#predefined]]
257+
and the relative color syntax from [[css-color-5#relative-colors]].
258+
259+
Its syntax is now as follows:
260+
261+
<pre class='prod'>
262+
<dfn>color()</dfn> = color( [from <<color>>]? <<colorspace-params>> [ / [ <<alpha-value>> | none ] ]? )
263+
<dfn>&lt;colorspace-params></dfn> = [<<custom-params>> | <<predefined-rgb-params>> |
264+
<<predefined-polar-params>> | <<predefined-rectangular-params>> | <<xyz-params>>]
265+
<dfn>&lt;custom-params></dfn> = <<dashed-ident>> [ <<number>> | <<percentage>> | none ]+
266+
<dfn>&lt;predefined-rgb-params></dfn> = <<predefined-rgb>> [ <<number>> | <<percentage>> | none ]{3}
267+
<dfn>&lt;predefined-polar-params></dfn> = jzczhz [ <<number>> | <<percentage>> | none ]{2} [ <<hue>> | none]
268+
<dfn>&lt;predefined-rectangular-params></dfn> = <<predefined-rectangular>> [ <<number>> | <<percentage>> | none ]{3}
269+
<dfn>&lt;predefined-rgb></dfn> = srgb | srgb-linear | display-p3 | a98-rgb | prophoto-rgb | rec2020 |
270+
rec2100-pq | rec2100-hlg | rec2100-linear
271+
<dfn>&lt;predefined-rectangular></dfn> = jzazbz | ictcp
272+
<dfn>&lt;xyz-params></dfn> = <<xyz>> [ <<number>> | <<percentage>> | none ]{3}
273+
<dfn>&lt;xyz></dfn> = xyz | xyz-d50 | xyz-d65
274+
</pre>
275+
246276
Predefined color spaces for HDR: {#predefined-HDR}
247277
=====================
248278

249279
In addition to the <a href="https://drafts.csswg.org/css-color-4/#predefined">SDR
250280
color spaces</a> defined by CSS Color 4, the following HDR color spaces are defined
251-
for use in the color function [[css-color-4#color-function]].
281+
for use in the color function.
252282

253283
Serialization of values in these new color spaces is identical to the description in [[css-color-4#serializing-color-values]].
254284

0 commit comments

Comments
 (0)