This specification is a Last Call Working Draft, although it was previously a Candidate Recommendation. It has been returned to Last Call Working Draft because this draft removes features that were not implemented sufficiently to advance to Proposed Recommendation, and had not been previously listed as at risk, as required by the W3C Process. This specification may advance directly to Proposed Recommendation following the last call, depending on comments and implementation reports. All persons are encouraged to review this document and send comments to the www-style mailing list as described above. The deadline for comments is 1 September 2008.
There must be at least two interoperable implementations for every feature in the Color Module. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms:
Passing the respective test case(s) in the official official CSS Color test suite, or, if the implementation is not a Web browser, an equivalent test. Every relevant test in the test suite should have an equivalent test created if such a user agent (UA) is to be used to claim interoperability. In addition if such a UA is to be used to claim interoperability, then there must one or more additional UAs which can also pass those equivalent tests in the same way for the purpose of interoperability. The equivalent tests must be made publicly available for the purposes of peer review.
is available to the general public. The implementation may be a shipping product or other publicly available version (i.e. beta version, preview release, or "nightly build"). Non-shipping product releases must have implemented the feature(s) for a period of at least one month in order to demonstrate stability.
is not experimental (i.e. a version specifically designed to pass the test suite and not intended for normal usage going forward.)
A minimum of six months must have elapsed since entering Candidate Recommendation. (This happened on 14 November 2003.) This is to ensure that enough time is given for any remaining major errors to be caught.
The CSS Working Group believes this document can be considered stable. It can still be updated by the Working Group, but only to clarify its meaning. If, unexpectedly, serious problems are found, it will be returned to Working Draft status. Otherwise, as soon as the exit criteria are met, it will progress to become Proposed Recommendation.
The comments received during the Last Call period (for the 14 February 2003 draft) and how they were addressed can be found in the disposition of comments.
The comments received during the Candidate Recommendation period (for the 14 May 2003 draft) and how they were addressed in this draft can be found in the disposition of comments.
3.1 Foreground color: the ‘color’ property
3.1.1 Gamma correction
3.2 Transparency: the ‘opacity’ property
4.1 HTML4 color keywords
4.2 Numerical color values
4.2.1 RGB color values
4.2.2 RGBA color values
4.2.3 ‘transparent’ color keyword
4.2.4 HSL color values
4.2.5 HSLA color values
4.3 SVG color keywords
4.4 'currentColor' color keyword
4.5 CSS System Colors
4.6 Notes on using colors
11.2 Informative
It not only defines the color related properties and values that already exist in CSS1 and CSS2, but also defines new properties and values.
The Working Group doesn't expect that all implementations of CSS3 will implement all properties or values. Instead, there will probably be a small number of variants of CSS3, so-called "profiles". For example, it may be that only the profile for 32-bit color user agents will include all of the proposed color related properties and values.
This property describes the foreground color of an element's text content. In addition it is used to provide a potential indirect value (currentColor) for any other properties that accept color values. If the 'currentColor' keyword is set on the ‘color’ property itself, it is treated as ‘color:inherit’.
For information about gamma issues, please consult the Gamma Tutorial in the PNG specification ([PNG2e]).
Opacity can be thought of conceptually as a postprocessing operation. Conceptually, after the element (including its descendants) is rendered into an RGBA offscreen image, the opacity setting specifies how to blend the offscreen rendering into the current composite rendering. See simple alpha compositing for details.
Since an element with opacity less than 1 is composited from a single offscreen image, content outside of it cannot be layered in z-order between pieces of content inside of it. For the same reason, implementations must create a new stacking context for any element with opacity less than 1. If an element with opacity less than 1 is not positioned, implementations must paint the layer it creates, within its parent stacking context, at the same stacking order that would be used if it were a positioned element with ‘z-index: 0’ and ‘opacity: 1’. If an element with opacity less than 1 is positioned, the ‘z-index’ property applies as described in [CSS21], except that ‘auto’ is treated as ‘0’ since a new stacking context is always created. See section 9.9 and Appendix E of [CSS21] for more information on stacking contexts. The rules in this paragraph do not apply to SVG elements, since SVG has its own rendering model [SVG11].
The RGB color model is extended in this specification to include ‘alpha’ to allow specification of the opacity of a color. See simple alpha compositing for details. These examples all specify the same color:
HSL colors are encoding as a triple (hue, saturation, lightness). Hue is represented as an angle of the color circle (i.e. the rainbow represented in a circle). This angle is so typically measured in degrees that the unit is implicit in CSS; syntactically, only a <number> is given. By definition red=0=360, and the other colors are spread around the circle, so green=120, blue=240, etc. As an angle, it implicitly wraps around such that -120=240 and 480=120. One way an implementation could normalize such an angle x to the range [0,360) is to compute ((x mod 360) + 360) mod 360). Saturation and lightness are represented as percentages. 100% is full saturation, and 0% is a shade of grey. 0% lightness is black, 100% lightness is white, and 50% lightness is ‘normal’.
The Y axis represents the lightness. 50% is ‘normal’.
CSS1 and CSS2 defined the initial value of the ‘border-color’ property to be the value of the ‘color’ property but did not define a corresponding keyword. This omission was recognized by SVG, and thus SVG 1.0 introduced the 'currentColor' value for the ‘fill’, ‘stroke’, ‘stop-color’, ‘flood-color’, ‘lighting-color’ properties. CSS3 extends the color value to include the 'currentColor' keyword to allow its use with all properties that accept a <color> value. This simplifies the definition of those properties in CSS3.
The value of the ‘color’ property. The computed value of the 'currentColor' keyword is the computed value of the ‘color’ property. If the 'currentColor' keyword is set on the ‘color’ property itself, it is treated as ‘color:inherit’ at parse time.
The CSS2 System Color values have been deprecated in favor of the CSS3 UI ‘appearance’ property for specifying the complete look of user interface related elements.
/* using attr() syntax from [CSS3VAL] */
color: attr(text,color);
‘orange’ color value (part of SVG color keywords) is accepted in CSS level 2 revision 1
Extra constraints 'currentColor' color value not valid for ‘color’ property.
A number of features that were present in the 14 May 2003 Candidate Recommendation are no longer present in this draft. However, the call for implementations for these features remains, and they may be included in a future level of this specification given sufficient implementations and a test suite to demonstrate interoperability. These features are:
Thanks to Brad Pettit both for writing up color-profiles, and for implementing it. Thanks to Steven Pemberton for his write up on HSL colors. Thanks especially to the feedback from Marc Attinasi, Bert Bos, Joe Clark, fantasai, Patrick Garies, Ian Hickson, Susan Lesch, Alex LeDonne, Cameron McCormack, Chris Moschini, Christoph Päper, Jacob Refstrup, Jonathan Stanley, Andrew Thompson, Russ Weakley, Etan Wexler, David Woolley, Boris Zbarsky, Steve Zilles, and all the rest of the www-style community. And thanks to Chris Lilley for being the resident CSS Color expert.
Colorimetry, Second Edition. CIE Publication 15.2-1986. ISBN 3-900-734-00-3
Image technology colour management — Architecture, profile format, and data structure. International Color Consortium. Specification ICC.1:2004-10 (Profile version 4.2.0.0) With errata incorporated, 5/22/2006. URL: http://color.org/ICC1v42_2006-05.pdf
[PNG2e]
David Duce. Portable Network Graphics (PNG) Specification (Second Edition). 10 November 2003. W3C Recommendation & ISO/IEC International Standard 15948:2003. Including later updates URL: http://www.w3.org/TR/2003/REC-PNG-20031110
Jon Ferraiolo; 藤沢 淳 (FUJISAWA Jun); Dean Jackson. Scalable Vector Graphics (SVG) 1.1 Specification. 14 January 2003. W3C Recommendation. URL: http://www.w3.org/TR/2003/REC-SVG11-20030114
Leo Geurts; Lambert Meertens; Steven Pemberton. The ABC Programmer's Handbook. ISBN: 0-13-000027-2. URL: http://www.cwi.nl/~steven/abc
Wendy Chisholm; Gregg Vanderheiden; Ian Jacobs. Web Content Accessibility Guidelines 1.0. 5 May 1999. W3C Recommendation. URL: http://www.w3.org/TR/1999/WAI-WEBCONTENT-19990505
This specification is a Last Call Working Draft, although it was previously a Candidate Recommendation. It has been returned to Last Call Working Draft because this draft removes features that were not implemented sufficiently to advance to Proposed Recommendation, and had not been previously listed as at risk, as required by the W3C Process. This specification may advance directly to Proposed Recommendation following the last call, depending on comments and implementation reports. All persons are encouraged to review this document and send comments to the www-style mailing list as described above. The deadline for comments is 1 September 2008.
There must be at least two interoperable implementations for every feature in the Color Module. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms:
Passing the respective test case(s) in the official official CSS Color test suite, or, if the implementation is not a Web browser, an equivalent test. Every relevant test in the test suite should have an equivalent test created if such a user agent (UA) is to be used to claim interoperability. In addition if such a UA is to be used to claim interoperability, then there must one or more additional UAs which can also pass those equivalent tests in the same way for the purpose of interoperability. The equivalent tests must be made publicly available for the purposes of peer review.
is available to the general public. The implementation may be a shipping product or other publicly available version (i.e. beta version, preview release, or "nightly build"). Non-shipping product releases must have implemented the feature(s) for a period of at least one month in order to demonstrate stability.
is not experimental (i.e. a version specifically designed to pass the test suite and not intended for normal usage going forward.)
A minimum of six months must have elapsed since entering Candidate Recommendation. (This happened on 14 November 2003.) This is to ensure that enough time is given for any remaining major errors to be caught.
The CSS Working Group believes this document can be considered stable. It can still be updated by the Working Group, but only to clarify its meaning. If, unexpectedly, serious problems are found, it will be returned to Working Draft status. Otherwise, as soon as the exit criteria are met, it will progress to become Proposed Recommendation.
The comments received during the Last Call period (for the 14 February 2003 draft) and how they were addressed can be found in the disposition of comments.
The comments received during the Candidate Recommendation period (for the 14 May 2003 draft) and how they were addressed in this draft can be found in the disposition of comments.
3.1 Foreground color: the ‘color’ property
3.1.1 Gamma correction
3.2 Transparency: the ‘opacity’ property
4.1 HTML4 color keywords
4.2 Numerical color values
4.2.1 RGB color values
4.2.2 RGBA color values
4.2.3 ‘transparent’ color keyword
4.2.4 HSL color values
4.2.5 HSLA color values
4.3 SVG color keywords
4.4 'currentColor' color keyword
4.5 CSS System Colors
4.6 Notes on using colors
11.2 Informative
It not only defines the color related properties and values that already exist in CSS1 and CSS2, but also defines new properties and values.
The Working Group doesn't expect that all implementations of CSS3 will implement all properties or values. Instead, there will probably be a small number of variants of CSS3, so-called "profiles". For example, it may be that only the profile for 32-bit color user agents will include all of the proposed color related properties and values.
This property describes the foreground color of an element's text content. In addition it is used to provide a potential indirect value (currentColor) for any other properties that accept color values. If the 'currentColor' keyword is set on the ‘color’ property itself, it is treated as ‘color:inherit’.
For information about gamma issues, please consult the Gamma Tutorial in the PNG specification ([PNG2e]).
Opacity can be thought of conceptually as a postprocessing operation. Conceptually, after the element (including its descendants) is rendered into an RGBA offscreen image, the opacity setting specifies how to blend the offscreen rendering into the current composite rendering. See simple alpha compositing for details.
Since an element with opacity less than 1 is composited from a single offscreen image, content outside of it cannot be layered in z-order between pieces of content inside of it. For the same reason, implementations must create a new stacking context for any element with opacity less than 1. If an element with op
acity less than 1 is not positioned, implementations must paint the layer it creates, within its parent stacking context, at the same stacking order that would be used if it were a positioned element with ‘z-index: 0’ and ‘opacity: 1’. If an element with opacity less than 1 is positioned, the ‘z-index’ property applies as described in [CSS21], except that ‘auto’ is treated as ‘0’ since a new stacking context is always created. See section 9.9 and Appendix E of [CSS21] for more information on stacking contexts. The rules in this paragraph do not apply to SVG elements, since SVG has its own rendering model [SVG11].
The RGB color model is extended in this specification to include ‘alpha’ to allow specification of the opacity of a color. See simple alpha compositing for details. These examples all specify the same color:
HSL colors are encoding as a triple (hue, saturation, lightness). Hue is represented as an angle of the color circle (i.e. the rainbow represented in a circle). This angle is so typically measured in degrees that the unit is implicit in CSS; syntactically, only a <number> is given. By definition red=0=360, and the other colors are spread around the circle, so green=120, blue=240, etc. As an angle, it implicitly wraps around such that -120=240 and 480=120. One way an implementation could normalize such an angle x to the range [0,360) is to compute ((x mod 360) + 360) mod 360). Saturation and lightness are represented as percentages. 100% is full saturation, and 0% is a shade of grey. 0% lightness is black, 100% lightness is white, and 50% lightness is ‘normal’.
The Y axis represents the lightness. 50% is ‘normal’.
CSS1 and CSS2 defined the initial value of the ‘border-color’ property to be the value of the ‘color’ property but did not define a corresponding keyword. This omission was recognized by SVG, and thus SVG 1.0 introduced the 'currentColor' value for the ‘fill’, ‘stroke’, ‘stop-color’, ‘flood-color’, ‘lighting-color’ properties. CSS3 extends the color value to include the 'currentColor' keyword to allow its use with all properties that accept a <color> value. This simplifies the definition of those properties in CSS3.
The value of the ‘color’ property. The computed value of the 'currentColor' keyword is the computed value of the ‘color’ property. If the 'currentColor' keyword is set on the ‘color’ property itself, it is treated as ‘color:inherit’ at parse time.
The CSS2 System Color values have been deprecated in favor of the CSS3 UI ‘appearance’ property for specifying the complete look of user interface related elements.
/* using attr() syntax from [CSS3VAL] */
color: attr(text,color);
‘orange’ color value (part of SVG color keywords) is accepted in CSS level 2 revision 1
Extra constraints 'currentColor' color value not valid for ‘color’ property.
A number of features that were present in the 14 May 2003 Candidate Recommendation are no longer present in this draft. However, the call for implementations for these features remains, and they may be included in a future level of this specification given sufficient implementations and a test suite to demonstrate interoperability. These features are:
Thanks to Brad Pettit both for writing up color-profiles, and for implementing it. Thanks to Steven Pemberton for his write up on HSL colors. Thanks especially to the feedback from Marc Attinasi, Bert Bos, Joe Clark, fantasai, Patrick Garies, Ian Hickson, Susan Lesch, Alex LeDonne, Cameron McCormack, Chris Moschini, Christoph Päper, Jacob Refstrup, Jonathan Stanley, Andrew Thompson, Russ Weakley, Etan Wexler, David Woolley, Boris Zbarsky, Steve Zilles, and all the rest of the www-style community. And thanks to Chris Lilley for being the resident CSS Color expert.
Colorimetry, Second Edition. CIE Publication 15.2-1986. ISBN 3-900-734-00-3
Image technology colour management — Architecture, profile format, and data structure. International Color Consortium. Specification ICC.1:2004-10 (Profile version 4.2.0.0) With errata incorporated, 5/22/2006. URL: http://color.org/ICC1v42_2006-05.pdf
[PNG2e]
David Duce. Portable Network Graphics (PNG) Specification (Second Edition). 10 November 2003. W3C Recommendation & ISO/IEC International Standard 15948:2003. Including later updates URL: http://www.w3.org/TR/2003/REC-PNG-20031110
Jon Ferraiolo; 藤沢 淳 (FUJISAWA Jun); Dean Jackson. Scalable Vector Graphics (SVG) 1.1 Specification. 14 January 2003. W3C Recommendation. URL: http://www.w3.org/TR/2003/REC-SVG11-20030114
Leo Geurts; Lambert Meertens; Steven Pemberton. The ABC Programmer's Handbook. ISBN: 0-13-000027-2. URL: http://www.cwi.nl/~steven/abc
Wendy Chisholm; Gregg Vanderheiden; Ian Jacobs. Web Content Accessibility Guidelines 1.0. 5 May 1999. W3C Recommendation. URL: http://www.w3.org/TR/1999/WAI-WEBCONTENT-19990505