Skip to content

Commit 08dcfc9

Browse files
committed
[css-color-5] Better define serialization of relative colors whose origin color is currentColor. sRGN, hsl and hwb serialize using color(srgb ...) to enable round-tripping.
1 parent db821b9 commit 08dcfc9

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

css-color-5/Overview.bs

+62-1
Original file line numberDiff line numberDiff line change
@@ -2863,7 +2863,68 @@ followed by ")".
28632863
<!-- need a more complex example, and one with calc too -->
28642864

28652865
The serialization of the result of a relative color function
2866-
is the resolved value.
2866+
depends on whether the keyword ''currentColor'' is the [=origin color=].
2867+
If so, the result is serialized as the specified value.
2868+
This allows the correct value to be used
2869+
on child elements whose ''color'' property has a different value.
2870+
Otherwise, it
2871+
is the resolved value,
2872+
which is a <<color>>,
2873+
as defined in [[css-color-4#serializing-color-values]].
2874+
2875+
The form used
2876+
depends on the color space of the [=origin color=]:
2877+
2878+
<table class="data">
2879+
<tr>
2880+
<th>mixing color space</th>
2881+
<th>form</th>
2882+
</tr>
2883+
<tr>
2884+
<td>srgb</td>
2885+
<td>color(srgb r g b)</td>
2886+
</tr>
2887+
<tr>
2888+
<td>srgb-linear</td>
2889+
<td>color(srgb-linear r g b) </td>
2890+
</tr>
2891+
<tr>
2892+
<td>hsl</td>
2893+
<td>color(srgb r g b) </td>
2894+
</tr>
2895+
<tr>
2896+
<td>hwb</td>
2897+
<td>color(srgb r g b)</td>
2898+
</tr>
2899+
<tr>
2900+
<td>xyz-d65</td>
2901+
<td>color(xyz-d65 x y z)</td>
2902+
</tr>
2903+
<tr>
2904+
<td>xyz-d50</td>
2905+
<td>color(xyz-d50 x y z)</td>
2906+
</tr>
2907+
<tr>
2908+
<td>xyz</td>
2909+
<td>color(xyz-d65 x y z)</td>
2910+
</tr>
2911+
<tr>
2912+
<td>lab</td>
2913+
<td>lab(l a b)</td>
2914+
</tr>
2915+
<tr>
2916+
<td>lch</td>
2917+
<td>lch(l c h)</td>
2918+
</tr>
2919+
<tr>
2920+
<td>oklab</td>
2921+
<td>oklab(l a b)</td>
2922+
</tr>
2923+
<tr>
2924+
<td>oklch</td>
2925+
<td>oklch(l c h)</td>
2926+
</tr>
2927+
</table>
28672928

28682929
<wpt>
28692930

0 commit comments

Comments
 (0)