Re: Color values to represent floating point colors

On Monday, March 5, 2012, 6:04:53 PM, Dr. wrote:

DOH> Chris Lilley:

>> This is the correct formal syntax (number rather than integer for the %
>> form):

>> color    ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?

>>              | "rgb(" wsp* integer comma integer comma integer wsp* ")"
>>              | "rgb(" wsp* number "%" comma number "%" comma number "%"
>>              | wsp* ")" color-keyword

>> hexdigit ::= [0-9A-Fa-f]
>> comma    ::= wsp* "," wsp*

>> where number links to
>> http://www.w3.org/TR/SVG/types.html#DataTypeNumber

DOH> Unfortunately (at least for additive animations of colours), the
DOH> CSS 2.0 recommendation has a problem as well. 
DOH> In the text it notes properly:
DOH> "The format of an RGB value in the functional notation is 'rgb(' followed by a
DOH> comma-separated list of three numerical values (either three integer values
DOH> or three percentage values) followed by ')'. "
DOH> But the example above notes:
DOH> "EM { color: rgb(255,0,0) }      /* integer range 0 - 255 */
DOH> EM { color: rgb(100%, 0%, 0%) } /* float range 0.0% - 100.0% */"
DOH> The example excludes negative values, but those are pretty useful for
DOH> additive color animations. 

Examples are non-normative, so the passing and inaccurate comment in that example has no normative basis.


DOH> Because the restriction in the example is removed in CSS2.1 again,
DOH> this looks like that it is assumed now, that the restriction in the example
DOH> was not really intended.

Yes.

DOH> Therefore finally it seems to be ok to use for example
DOH> rgb(-50.3%, -20.7%,-10.1%) or rgb(-200,30,-100)
DOH> as (animation) values in SVG to be able to reduce rgb values as well
DOH> with additive animations (I think, not all viewer manage this currently
DOH> unfortunately - maybe still a consequence of the inconsistent example in
DOH> CSS2.0).

DOH> Olaf







-- 
 Chris Lilley   Technical Director, Interaction Domain                 
 W3C Graphics Activity Lead, Fonts Activity Lead
 Co-Chair, W3C Hypertext CG
 Member, CSS, WebFonts, SVG Working Groups

Received on Monday, 5 March 2012 17:50:54 UTC