Re: Color values to represent floating point colors

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

Unfortunately (at least for additive animations of colours), the
CSS 2.0 recommendation has a problem as well. 
In the text it notes properly:
"The format of an RGB value in the functional notation is 'rgb(' followed by a 
comma-separated list of three numerical values (either three integer values 
or three percentage values) followed by ')'. "
But the example above notes:
"EM { color: rgb(255,0,0) }      /* integer range 0 - 255 */
EM { color: rgb(100%, 0%, 0%) } /* float range 0.0% - 100.0% */"
The example excludes negative values, but those are pretty useful for
additive color animations. 
Because the restriction in the example is removed in CSS2.1 again,
this looks like that it is assumed now, that the restriction in the example
was not really intended.
Therefore finally it seems to be ok to use for example
rgb(-50.3%, -20.7%,-10.1%) or rgb(-200,30,-100)
as (animation) values in SVG to be able to reduce rgb values as well
with additive animations (I think, not all viewer manage this currently 
unfortunately - maybe still a consequence of the inconsistent example in 
CSS2.0).

Olaf

Received on Monday, 5 March 2012 17:05:26 UTC