Skip to content

Commit 9cc2a6b

Browse files
committed
[css-color-5] Added examples of serialization of nested color functions. #10328
1 parent 31feeb7 commit 9cc2a6b

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

css-color-5/Overview.bs

+48-2
Original file line numberDiff line numberDiff line change
@@ -3142,14 +3142,60 @@ The serialization of the declared value of a relative color is:
31423142

31433143

31443144
<div class="example" id="ex-serial-rcs-specified-simple">
3145-
For example, the result of serializing the declared value
3145+
For example, the serialization of the declared value of
31463146

31473147
<pre class="lang-css">OkLcH(from peru l c h)</pre>
31483148

31493149
is the string "oklch(from peru l c h)"
31503150
</div>
31513151

3152-
<!-- need a more complex example, and one with calc too -->
3152+
<div class="example" id="ex-serial-rcs-calc">
3153+
For example, the serialization of the declared value of
3154+
3155+
<pre class="lang-css">rgb(from red calc(r / 2) g calc(30%));</pre>
3156+
3157+
is the string "rgb(from red calc(0.5 * r) g calc(30%))",
3158+
while the serialization of the computed value
3159+
is the string "color(srgb 0.5 0 0.3)".
3160+
</div>
3161+
3162+
<div class="example" id="ex-serial-rcs-nested-none">
3163+
For example, the serialization of the declared value of
3164+
3165+
<pre class="lang-css">hsl(from hsl(none 10% 50%) h s l);</pre>
3166+
3167+
is the string "hsl(from hsl(none 10% 50%) h s l)",
3168+
while the serialization of the computed value
3169+
is the string "color(srgb 0.55 0.45 0.45)".
3170+
</div>
3171+
3172+
<div class="example" id="ex-serial-rcs-hsl-unclamped">
3173+
For example, the serialization of the declared value of
3174+
3175+
<pre class="lang-css">hsl(from hsl(127.9 302% 25.33%) h s l);</pre>
3176+
3177+
is the string "hsl(from hsl(127.9 302% 25.33%) h s l)",
3178+
while the serialization of the computed value
3179+
is the string "color(srgb -0.511666 1.018266 -0.310225)".
3180+
</div>
3181+
3182+
<div class="example" id="ex-serial-rcs-currentcolor">
3183+
Given the following HTML (note the color property set on this element):
3184+
3185+
<pre class="lang-html">
3186+
&lt;div id="example"
3187+
style="background-color: rgb(from currentcolor r g calc(b / 2));
3188+
color: blue;">
3189+
&lt;/div>
3190+
</pre>
3191+
3192+
The serialization of the declared value of ''background-color''
3193+
is the string "rgb(from currentcolor r g calc(b / 2))"
3194+
while the serialization of the computed value
3195+
is the string "color(srgb 0 0 0.5)"
3196+
3197+
</div>
3198+
31533199

31543200
The serialization of the result of a relative color function
31553201
depends on whether the keyword ''currentColor'' is the [=origin color=].

0 commit comments

Comments
 (0)