|
40 | 40 | </a></p> |
41 | 41 | <h1 class="p-name no-ref" id=title>CSS Color Module Level 4</h1> |
42 | 42 | <h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft, |
43 | | - <span class=dt-updated><span class=value-title title=20130923>23 September 2013</span></span></span></h2> |
| 43 | + <span class=dt-updated><span class=value-title title=20130924>24 September 2013</span></span></span></h2> |
44 | 44 | <div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-color/>http://dev.w3.org/csswg/css-color/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-color/>http://dev.w3.org/csswg/css-color/</a> |
45 | 45 | <dt>Feedback:</dt> |
46 | 46 | <dd><a href="mailto:www-style@w3.org?subject=%5Bcss-color%5D%20feedback">www-style@w3.org</a> |
@@ -1698,12 +1698,52 @@ <h2 class="heading settled heading" data-level=6 id=grays><span class=secno>6 </ |
1698 | 1698 |
|
1699 | 1699 |
|
1700 | 1700 | <h2 class="heading settled heading" data-level=7 id=cmyk-colors><span class=secno>7 </span><span class=content> |
1701 | | -CMYK Colors: the <span class=css data-link-type=maybe title=device-cmyk()>device-cmyk()</span> function</span><a class=self-link href=#cmyk-colors></a></h2> |
| 1701 | +CMYK Colors: the <a class=css data-link-type=maybe href=#funcdef-device-cmyk title=device-cmyk()>device-cmyk()</a> function</span><a class=self-link href=#cmyk-colors></a></h2> |
1702 | 1702 |
|
1703 | | - <p class=issue id=issue-84e118fb><a class=self-link href=#issue-84e118fb></a> |
1704 | | - Import the <span class=css data-link-type=maybe title=device-cmyk()>device-cmyk()</span> definition from GCPM, |
1705 | | - filling in the spec details we hammered out at the Paris 2013 F2F. |
| 1703 | +<p> While screens typically display colors directly with RGB pixels, |
| 1704 | + printers often represent colors in different ways. |
| 1705 | + In particular, one of the most common print-based ways of representing colors is with CMYK: |
| 1706 | + a combination of cyan, magenta, yellow, and black. |
| 1707 | + The <a class=css data-link-type=maybe href=#funcdef-device-cmyk title=device-cmyk()>device-cmyk()</a> function allows authors to specify a color in this way: |
1706 | 1708 |
|
| 1709 | + <pre class=prod> <dfn class=css-code data-dfn-type=function data-export="" id=funcdef-device-cmyk title=device-cmyk()>device-cmyk()<a class=self-link href=#funcdef-device-cmyk></a></dfn> = device-cmyk( <a class="production css-code" data-link-type=type href=#typedef-cmyk-components title="<cmyk-components>"><cmyk-components></a> [, <a class="production css-code" data-link-type=type href=#typedef-alpha-value title="<alpha-value>"><alpha-value></a>]? [, <a class="production css-code" data-link-type=type href=#typedef-color title="<color>"><color></a> ]? ) |
| 1710 | + <dfn class=css-code data-dfn-type=type data-export="" id=typedef-cmyk-components><cmyk-components><a class=self-link href=#typedef-cmyk-components></a></dfn> = <a class="production css-code" data-link-type=type href=#typedef-cmyk-component title="<cmyk-component>"><cmyk-component></a>, <a class="production css-code" data-link-type=type href=#typedef-cmyk-component title="<cmyk-component>"><cmyk-component></a>, <a class="production css-code" data-link-type=type href=#typedef-cmyk-component title="<cmyk-component>"><cmyk-component></a>, <a class="production css-code" data-link-type=type href=#typedef-cmyk-component title="<cmyk-component>"><cmyk-component></a> |
| 1711 | + <dfn class=css-code data-dfn-type=type data-export="" id=typedef-cmyk-component><cmyk-component><a class=self-link href=#typedef-cmyk-component></a></dfn> = <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#number-value title="<number>"><number></a> | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a> |
| 1712 | +</pre> |
| 1713 | +<p> The arguments of the <a class=css data-link-type=maybe href=#funcdef-device-cmyk title=device-cmyk()>device-cmyk()</a> function specify the cyan, magenta, yellow, and black components, in order, |
| 1714 | + as a number between 0 and 1 or a percentage between 0% and 100%. |
| 1715 | + These two usages are equivalent, and map to each other linearly. |
| 1716 | + Values less than 0 or 0%, or greater than 1 or 100%, |
| 1717 | + are not invalid; |
| 1718 | + instead, they are clamped to 0/0% or 1/100%. |
| 1719 | + |
| 1720 | +<p> The fifth argument specifies the alpha channel of the color. |
| 1721 | + It’s interpreted identically to the fourth argument of the <a class=css data-link-type=maybe href=#funcdef-rgba title=rgba()>rgba()</a> function. |
| 1722 | + If omitted, it defaults to <span class=css data-link-type=maybe title=100%>100%</span>. |
| 1723 | + |
| 1724 | +<p> The sixth argument specifies the fallback color, |
| 1725 | + used when the user agent doesn’t know how to accurately transform the CMYK color to RGB. |
| 1726 | + If omitted, it defaults to an RGBA color calculated as follows: |
| 1727 | + |
| 1728 | +<p> <ul> |
| 1729 | + <li><code>red = 1.0 - min(1.0, cyan + black)</code> |
| 1730 | + <li><code>green = 1.0 - min(1.0, magenta + black)</code> |
| 1731 | + <li><code>blue = 1.0 - min(1.0, yellow + black)</code> |
| 1732 | + <li>Alpha remains as specified. |
| 1733 | + </ul> |
| 1734 | + |
| 1735 | +<p> Typically, print-based applications will actually store the used colors as CMYK, |
| 1736 | + and send them to the printer in that form. |
| 1737 | + Unfortunately, CSS cannot do that; |
| 1738 | + various CSS features require an RGB color, |
| 1739 | + so that compositing/blending/etc. can be done. |
| 1740 | + As such, CMYK colors must be converted to an equivalent RGB color. |
| 1741 | + This is not trivial, like the conversion from HSL or HWB to RGB; |
| 1742 | + the precise conversion depends on the precise characteristics of the output device. |
| 1743 | + |
| 1744 | +<p> If the user agent has information about the output device such that it believes it can accurately convert the CMYK color to a correct RGB color, |
| 1745 | + the computed value of the <a class=css data-link-type=maybe href=#funcdef-device-cmyk title=device-cmyk()>device-cmyk()</a> function must be that RGBA color. |
| 1746 | + Otherwise, the computed value must be the fallback color. |
1707 | 1747 |
|
1708 | 1748 |
|
1709 | 1749 | <h2 class="heading settled heading" data-level=8 id=modifying-colors><span class=secno>8 </span><span class=content> |
@@ -2633,6 +2673,8 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content> |
2633 | 2673 | <li>CaptionText, <a href=#captiontext title="section Unnumbered section">Unnumbered section</a> |
2634 | 2674 | <li>chartreuse (value), <a href=#valuedef-chartreuse title="section 3.3">3.3</a> |
2635 | 2675 | <li>chocolate (value), <a href=#valuedef-chocolate title="section 3.3">3.3</a> |
| 2676 | +<li><cmyk-component>, <a href=#typedef-cmyk-component title="section 7">7</a> |
| 2677 | +<li><cmyk-components>, <a href=#typedef-cmyk-components title="section 7">7</a> |
2636 | 2678 | <li><color>, <a href=#typedef-color title="section 3">3</a> |
2637 | 2679 | <li>color(), <a href=#funcdef-color title="section 8">8</a> |
2638 | 2680 | <li><color-adjuster>, <a href=#typedef-color-adjuster title="section 8">8</a> |
@@ -2665,6 +2707,7 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content> |
2665 | 2707 | <li>darkviolet (value), <a href=#valuedef-darkviolet title="section 3.3">3.3</a> |
2666 | 2708 | <li>deeppink (value), <a href=#valuedef-deeppink title="section 3.3">3.3</a> |
2667 | 2709 | <li>deepskyblue (value), <a href=#valuedef-deepskyblue title="section 3.3">3.3</a> |
| 2710 | +<li>device-cmyk(), <a href=#funcdef-device-cmyk title="section 7">7</a> |
2668 | 2711 | <li>dimgray (value), <a href=#valuedef-dimgray title="section 3.3">3.3</a> |
2669 | 2712 | <li>dimgrey (value), <a href=#valuedef-dimgrey title="section 3.3">3.3</a> |
2670 | 2713 | <li>dodgerblue (value), <a href=#valuedef-dodgerblue title="section 3.3">3.3</a> |
@@ -2843,13 +2886,7 @@ <h2 class="no-num heading settled" id=issues-index><span class=content>Issues In |
2843 | 2886 | </p><a href=#issue-f73c1044> ↵ </a></div> |
2844 | 2887 |
|
2845 | 2888 |
|
2846 | | -<p class=issue> |
2847 | | - Import the <span class=css data-link-type=maybe title=device-cmyk()>device-cmyk()</span> definition from GCPM, |
2848 | | - filling in the spec details we hammered out at the Paris 2013 F2F. |
2849 | | - |
2850 | | - |
2851 | | - |
2852 | | -<a href=#issue-84e118fb> ↵ </a><div class=issue> |
| 2889 | +<div class=issue> |
2853 | 2890 | More possibilities: |
2854 | 2891 |
|
2855 | 2892 | <p> <ul> |
|
0 commit comments