Re: HTML 3.2 PR color value syntax

James Aylett wrote:
> 
> RffGffBff - RGB values in hex
> R100%G100%B100% - RGB values in percentages (just to please the few ...)
> 
> Given the R,G,B delimiters it would be possible to add other colour 
> models; CMYK, HSV etc. From the point of view of using the web to publish
> documents originally designer for printing this would make for easier
> conversion; in addition to this many graphics and painting packages
> support these colour models because they are (in general) easier for
> artists, printers or whatever to think in than the light-mixing RGB model.

I think that looks messy and hard to read though.  I would be happy to
support CYMK, HSV & CIE if an appropriate syntax could be agreed
upon.  Have to be careful with % symbols in the attribute value.  How is
the colour type defined?

I think rather than R100%G100%B100% it would be better to have:

RGB:50%,0%,50%
CYMK:0%,100%,0%,50%

etc.  I find that much easier to read (both in a parser and as a human!)
Using this prefix style of notation also leaves open the possibility of
adding different colour models in the future.  From the browser
implementation point of view, this could be handled by having a set of
small programs that can do the colour conversion for the models which
the browser does not know which turn it into an RGB presentation.

Alternatively, how about introducing a <colour> tag for defining local
colour names.  eg.

<!ENTITY COLOURMODELS "(rgb|cymk|cie|hsv)">

<!ELEMENT COLOUR - O EMPTY>
<!ATTLIST COLOUR
    name  CDATA          #REQUIRED   -- textual name --
    value CDATA          #REQUIRED   -- comma separated values --
    model %COLOURMODELS  #IMPLIED    -- defaults to RGB --
    >

This gets around the problem of the browser not knowing the meaning of a
new colour format, since it can be embedded in the document itself.  It
also means that document authors can define a colour setting once and then
refer to it by name throughout the document, although it would probably be
less useful in the presence of stylesheets.

> If we're going to extend the accepted syntax, at least let's do it
> usefully rather than just adding random hacks whenever anyone has an idea.
> The old #rrggbb format could easily be kept for backwards compatability.

I've seen people omit the # character in some places, so I've allowed
for that in my colour parser.  I also use an external file mapping
colour names to RGB values (the file is the same format as X's
rgb.txt.  The colour name table is seeded with the 16 "Microsoft
standard" colours from Wilbur but can be overridden by the
configuration file.

Colour handling is something which I think should be controllable outside
the browser application if necessary.  For example, people with monochrome
displays might have special files which change the mappings of the textual
names to different RGB values for a better display on their system.

-- 
Stewart Brodie, Electronics & Computer Science, Southampton University.
http://www.ecs.soton.ac.uk/~snb94r/      http://delenn.ecs.soton.ac.uk/

Received on Tuesday, 12 November 1996 06:48:13 UTC