Skip to content

Commit 526015b

Browse files
committed
[css-color-4] remove color() fallback. Fix #5931
1 parent 62eb394 commit 526015b

File tree

1 file changed

+29
-62
lines changed

1 file changed

+29
-62
lines changed

css-color-4/Overview.bs

+29-62
Original file line numberDiff line numberDiff line change
@@ -3094,7 +3094,6 @@ Profiled, Device-dependent Colors</h2>
30943094
In each case, the numerical parameters
30953095
are in the range 0.0 to 1.0
30963096
(rather than, for example, 0 to 255).
3097-
<!-- add examples with alpha, and with fallback -->
30983097
<pre class="lang-css">
30993098
color: color(--swopc 0.0134 0.8078 0.7451 0.3019);
31003099
color: color(--indigo 0.0941 0.6274 0.3372 0.1647 0 0.0706 0.1216);
@@ -3124,19 +3123,17 @@ Profiled, Device-dependent Colors</h2>
31243123
Its syntax is:
31253124

31263125
<pre class='prod'>
3127-
<dfn>color()</dfn> = color( [ [<<ident>> | <<dashed-ident>>] [ <<number-percentage>>+ ] [ / <<alpha-value>> ]? ]# , <<color>>? )
3126+
<dfn>color()</dfn> = color( [<<ident>> | <<dashed-ident>>] [ <<number-percentage>>+ ] [ / <<alpha-value>> ]? )
31283127
</pre>
31293128

3129+
<!-- check this test, remove any fallback testing -->
31303130
<wpt>
31313131
color-function-parsing.html
31323132
</wpt>
31333133

3134-
The color function takes one or more comma-separated arguments,
3135-
with each argument specifying a color,
3136-
and later colors acting as "fallback" if an earlier color [=can't be displayed=]
3137-
(for example, if the colorspace it specifies hasn't been loaded yet).
3134+
The color function takes parameters specifying a color, in an explicitly listed colorspace.
31383135

3139-
Each argument represents either an <dfn export>invalid color</dfn>, as described below,
3136+
It represents either an <dfn export>invalid color</dfn>, as described below,
31403137
or a [=valid color=].
31413138

31423139
Any color which is not an [=invalid color=] is a <dfn export>valid color</dfn>.
@@ -3158,7 +3155,7 @@ Profiled, Device-dependent Colors</h2>
31583155
Each [=valid color=] is either in-gamut for the output device (screen, or printer),
31593156
or it is [=out of gamut=].
31603157

3161-
Each argument has the following form:
3158+
The parameters have the following form:
31623159

31633160
* An <<ident>> or <<dashed-ident>> denoting the colorspace.
31643161
If this is an <<ident>> it denotes one of the <a href="#predefined">predefined colorspaces</a>
@@ -3218,40 +3215,31 @@ Profiled, Device-dependent Colors</h2>
32183215
This is interpreted the same way as the <<alpha-value>> in ''rgb()'',
32193216
and if omitted it defaults to ''100%''.
32203217

3221-
After one or more arguments of the above form,
3222-
a final <<color>> argument
3223-
using any CSS color syntax
3224-
can be provided.
32253218

3219+
<!--
3220+
remove this from wpt
32263221
<wpt>
32273222
predefined-015.html
3228-
</wpt>
3223+
</wpt> -->
32293224

3230-
This final argument can again be either a [=valid color=]
3231-
or an [=invalid color=]; and if valid it can be either
3232-
in-gamut for the output device, or [=out of gamut=].
32333225

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

3238-
The first choice for the value of the ''color()'' function
3239-
is that it represents the color
3240-
specified by the first of its arguments that
3241-
<dfn export>can be displayed</dfn>,
3242-
(that is, the first argument that isn't an [=invalid color=]
3243-
and isn't [=out of gamut=]).
3244-
3245-
If all of its arguments [=can't be displayed=]],
3246-
second choice for the value of the ''color()'' function
3247-
is that it represents the color
3248-
specified by the first of its arguments that represent
3249-
a [=valid color=], which will then be
3230+
If the specified color <dfn export>can be displayed</dfn>,
3231+
(that is, it isn't an [=invalid color=]
3232+
and isn't [=out of gamut=])
3233+
then this is the used value of the ''color()'' function.
3234+
3235+
If the specified color
3236+
is a [=valid color=]
3237+
but [=can't be displayed=]],
3238+
the used value is derived from the specified color,
32503239
<a>gamut-mapped</a> for display.
32513240

3252-
If all of its arguments are [=invalid color=]s,
3253-
the third choice for the value of the ''color()'' function
3254-
is that it represents <a>opaque black</a>.
3241+
If the color is an [=invalid color=],
3242+
the used value is <a>opaque black</a>.
32553243

32563244

32573245
<div class="example" id="ex-2020-oog-p3">
@@ -3274,34 +3262,11 @@ Profiled, Device-dependent Colors</h2>
32743262
produced automatically by gamut mapping.
32753263
</div>
32763264

3277-
<div class="example" id="ex-2020-fallback">
3278-
The same color as the previous example is now specified with a fallback
3279-
<pre class="lang-css">color(rec2020 0.42053 0.979780 0.00579, color(display-p3(0 1 0)));</pre>
3280-
On a display-p3 screen,
3281-
because the first-choice color can't be displayed
3282-
and because a fallback has been given which is in-gamut for the display,
3283-
the fallback color will be used.
3284-
</div>
3285-
3286-
<div class="example" id="ex-prophoto-two-fallbacks">
3287-
An intense green is provided in prophoto-rgb space.
3288-
It has a first fallback, which is the same color in display-p3
3289-
in case prophoto is unsupported. The color is in gamut of display-p3.
3290-
Lastly, a desaturated sRGB fallback is provided
3291-
(desaturated, as the original color is outside the sRGB gamut).
3292-
<pre class="lang-css">color(prophoto-rgb 0.4835 0.9167 0.2188, color(display-p3 0.3499 0.9800 0.1399, rgb(33.44% 96.68% 21.07%)))</pre>
3293-
</div>
3294-
32953265
<div class="invalid example" id="ex-profoto-bad">
3296-
Same as the previous example, but with a typo!
3266+
This example has a typo!
32973267
An intense green is provided in profoto-rgb space (which doesn't exist).
3298-
Ths makes it invalid, so we go to the first fallback, which is the same color in display-p3.
3299-
The color is in gamut of display-p3.
3300-
Lastly, a desaturated sRGB fallback is provided.
3301-
If the output device is limited to sRGB gamut,
3302-
the display-p3 value will be <em>out of output gamut</em>
3303-
so the desaturated, sRGB value is used.
3304-
<pre class="lang-css">color(profoto-rgb 0.4835 0.9167 0.2188, color(display-p3 0.3499 0.9800 0.1399, rgb(33.44% 96.68% 21.07%)))</pre>
3268+
This makes it invalid, so the used value is <a>opaque black</a>
3269+
<pre class="lang-css">color(profoto-rgb 0.4835 0.9167 0.2188)</pre>
33053270
</div>
33063271

33073272
<h3 id="predefined">
@@ -3995,14 +3960,17 @@ can proceed as normal.
39953960
</div>
39963961

39973962
Fallback colors can be specified,
3998-
for example if the specified CMYK color is known
3963+
for example using media queries,
3964+
to be used
3965+
if the specified CMYK color is known
39993966
to be outside the sRGB gamut.
40003967

40013968
<div class="example" id="ex-fogra39-fallback-mq">
40023969
This example uses the same FOGRA39 setup as before,
40033970
but specifies a bright green which is outside the sRGB gamut.
40043971
It is, however, inside the display-p3 gamut.
40053972
Therefore it is displayed as-is on wide gamut screens
3973+
and in print,
40063974
and a less intense fallback color is used on sRGB screens.
40073975

40083976
<!--
@@ -4016,7 +3984,7 @@ to be outside the sRGB gamut.
40163984
<pre class="lang-css">
40173985
@media (color-gamut: srgb) {
40183986
.header {
4019-
background-color: color(--fogra39 90% 0% 90% 0%, <span class="swatch" style="--color: rgb(8.154% 60.9704% 37.184%)"></span> rgb(8.154% 60.9704% 37.184%));
3987+
background-color: rgb(8.154% 60.9704% 37.184%);
40203988
}
40213989
}
40223990
@media print, (color-gamut: p3){
@@ -4037,11 +4005,10 @@ to be outside the sRGB gamut.
40374005
Reducing the chroma until the result is in gamut
40384006
gives lch(56.596645% 51 154.5533771086801)
40394007
which is rgb(8.154% 60.9704% 37.184%)
4040-
and this is used as the fallback color.
4008+
and this has been manually specified as a fallback color.
40414009

40424010
For wide gamut screens, the color is inside the display-p3 gamut
4043-
so no fallback need be specified.
4044-
However, for the curious, the color is display-p3(0.1658 0.6147 0.3533).
4011+
(it is display-p3(0.1658 0.6147 0.3533) ).
40454012

40464013
<!--
40474014
grn=[56.596645, -58.995875, 28.072154 ]

0 commit comments

Comments
 (0)