W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Re: Propsal: Mechanism for converting rgb, hex, and named color strings between one another

From: Peter Moulder <peter.moulder@monash.edu>
Date: Sun, 26 Sep 2010 22:41:01 +1000
To: www-style@w3.org
Message-id: <20100926124101.GA21185@bowman.infotech.monash.edu.au>
Something to keep in mind is that not all rgb() values can in fact be expressed
as in hex format (or, obviously, in name form): CSS2.1 hex format is restricted
to 8 bits per channel, and is restricted to within the gamut of sRGB.
rgb() form has neither of these restrictions.  (Though all colours in CSS2.1
are restricted to the gamut of the target device when this is known.)

(Reference: http://www.w3.org/TR/CSS21/syndata.html#color-units, 
 mainly towards the end of that subsection.)

This is relevant at least to the documentation for such a feature, and may also
affect the choice of representation.  It may even mean that it's worthwhile
providing a separate function to give hex format (either conditionally or
closest approximation).

Received on Sunday, 26 September 2010 12:41:33 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:13:50 UTC