W3C home > Mailing lists > Public > www-style@w3.org > January 2011

Re: [css3-color] Fractional values for HSL

From: Peter Beverloo <peter@lvp-media.com>
Date: Tue, 4 Jan 2011 17:00:41 +0100
Message-ID: <AANLkTimg+iPci_TCqgscyQr5ROgvforCR9CSwC4EQE-Y@mail.gmail.com>
To: Rob Crowther <robertc@boogdesign.com>
Cc: "www-style@w3.org list" <www-style@w3.org>
On Tue, Jan 4, 2011 at 16:16, Rob Crowther <robertc@boogdesign.com> wrote:
> The spec doesn't seem to mention: are fractional values allowed in HSL notation?  For example if I have a color hsl(210,50%,40%) and want one at one third of the level can I use hsl(210,50%,13.3%)?  Is it actually going to be any different to hsl(210,50%,13%)?
> Firefox and Opera seem to handle it fine, but I'm not sure if they're just rounding things internally or something.
> Rob

The Color module mentions that the first value for hsl() is a number,
and the two following values are percentages. According to the Syntax
module[1], percentages get parsed as:

[0-9]+|[0-9]*"."[0-9]+ %

So syntactical speaking: yes, they are allowed. I wouldn't know
whether the displayed color differs based on the fraction for any
browser. Can't you compare the displayed colors of
"hsl(210,50%,40.999%)" with "hsl(210,50%,40.001%)"?

Kind regards,
Peter Beverloo

[1] http://www.w3.org/TR/css3-syntax/#lexical
Received on Tuesday, 4 January 2011 16:02:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:54 UTC