Skip to content

Commit d816491

Browse files
committed
[css-color-6] Add color-layers() function, #8431
1 parent 91b02cc commit d816491

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

css-color-6/Overview.bs

+55-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ spec:css-color-3
2525

2626
<pre class="link-defaults">
2727
spec:css-color-5; type:dfn; text:color
28+
spec:compositing-1; type:value; text:normal
2829
</pre>
2930
<link rel="stylesheet" href="style.css" />
3031

@@ -34,8 +35,8 @@ Introduction {#intro}
3435

3536
<em>This section is not normative.</em>
3637

37-
This module adds a new <<color>> function:
38-
''contrast-color()''.
38+
This module adds a\two new <<color>> functions:
39+
''contrast-color()'' and ''color-layers()''.
3940

4041

4142

@@ -295,7 +296,59 @@ Contrasting Semi-transparent Colors</h4>
295296
to find an opaque foreground color.
296297

297298

299+
<!--
298300

301+
█▌ ███▌ █ ▐▌ █████▌ ████▌ ███▌
302+
█▌ ▐█ ▐█ ▐▌ █ █▌ █▌ █▌ █▌ █▌
303+
█▌ █▌ █▌ █ ▐▌ █▌ █▌ █▌ █▌
304+
█▌ █▌ █▌ ▐▌█ ████ ████▌ ███▌
305+
█▌ █████▌ █▌ █▌ █▌▐█ █▌
306+
█▌ █▌ █▌ █▌ █▌ █▌ ▐█ █▌ █▌
307+
█████ █▌ █▌ █▌ █████▌ █▌ █▌ ███▌
308+
-->
309+
310+
Layering Multiple Colors: the ''color-layers()'' function {#colorclayers}
311+
=========================================================================
312+
313+
The <dfn>color-layers()</dfn> [=functional notation=]
314+
takes an optional <<blend-mode>>
315+
followed by a list of two or more
316+
<<color>> layers.
317+
318+
Its syntax is:
319+
320+
<pre class='prod'>
321+
<<color-layers()>> = color-layers([ <<blend-mode>>, ]? <<color>># )
322+
</pre>
323+
324+
It returns a <<color>> which is
325+
the result of compositing these layers,
326+
using the [[compositing-1#porterduffcompositingoperators_srcover]]
327+
compositing operator and the specified
328+
<<blend-mode>>.
329+
330+
If no <<blend-mode>> is given,
331+
''normal'' blend-mode is used.
332+
333+
<div class="example">
334+
@@Add simple example with normal blend mode
335+
and two colors, the first of which has non-unity alpha
336+
</div>
337+
338+
<div class="example">
339+
@@Add simple example with normal blend mode
340+
and three colors, the first two of which have non-unity alpha
341+
</div>
342+
343+
<div class="example">
344+
@@Add simple example with normal blend mode
345+
and two colors, both of which have non-unity alpha
346+
</div>
347+
348+
<div class="example">
349+
@@Add example with overlay blend mode
350+
and two colors, the first of which has non-unity alpha
351+
</div>
299352

300353
<!--
301354
████████ ████████ ██████ ███████ ██ ██ ██ ████████

0 commit comments

Comments
 (0)