On Friday, 6 June 2025 05:24:21 BST G. Branden Robinson wrote:
> Hi Deri,
> 
> At 2025-06-06T00:08:38+0100, Deri wrote:
> > I have been comparing HTML and X colour names, results attached as a
> > pdf (and a text version which should be piped through "less -R" to see
> > the colours).
> 
> Neat!  I can image the groff document you might have used to compose it,
> though I wonder why tbl(1), if that's what you used, under-sized the
> first column in nroff mode, causing "lightgoldenrodyellow" to overrun.

Mea culpa, I did not use tbl! Just tabs and a .ta. Problem was the first list 
of HTML colours garnered from the internet was incomplete and all the names 
"fitted", when I did a final check against the official W3C list I found some 
more colours, including "lightgoldenrodyellow" and did not notice it overran 
the tab length, and given my use of \Z to plant the text, neither did groff.

> > The background colour represents the named colour. For colours marked
> > "Same" the HTML and X have matched names and RGB values. If it refers
> > "X=name" it means that for the same RGB value X has a different name,
> > however there is nothing to stop a single RBG value having two names,
> > so we could add the HTML name as such an alias.
> > 
> > A colour marked as "Missing" means that no X colour has the particular
> > RBG value, the closest nearest RBG colour is shown in the third
> > column, the HTML name could be added to our list.
> > 
> > The last group are where the names are the same but the RBG values are
> > different (shown by the HTML colour in col 2, and X in col 3). There
> > are 4 colours afffected. Xorg-rgb 1.0.6 addressed this by adding
> > "aliases" with the suffixes "web" or "x11".
> 
> I can imagine that a document author might prefer one color repertoire
> or the other regardless of their choice of output device, so I perceive
> little benefit in *tightly* coupling one to a device macro file.
> 
> Would it make sense to offer two macro files, "color-html.tmac" and
> "color-x11.tmac"?  I reckon the "html" and "xhtml" devices would load
> the former by default and the X11 devices the latter by default.

I think you are right. It might be a good idea to add the 4 differing colours 
with an x11 suffix to "color-html.tmac" and with "web" suffix to color-
x11.tmac.

Currently the colours in html.tmac are a mish-mash!

.defcolor purple rgb #8e35ef
.defcolor purple1 rgb #893bff
.defcolor purple2 rgb #7f38ec
.defcolor purple3 rgb #6c2dc7
.defcolor purple4 rgb #461b7e

The colour "purple" matches neither HTML nor X11! In fact I ran my diff 
program comparing the official HTML colours against the colours in html.tmac 
(with surprising results) practically none of them matched! See attached HTML-
TmacColours.pdf (this time "X=" colours are the colours in html.tmac).

So then I wondered how the html.tmac colours compared with the X11 colours in 
ps.tmac. The results in X-TmacColours.pdf. First column "HTML=" value from 
html.tmac, "X=" X11 value from ps.tmac.

I will generate a color-html.tmac and color-x11.tmac for discussion.

> Which should be the default for the other devices?

ps and pdf would continue to use x11.

Cheers

Deri

> Of course no matter which macro file is loaded by default, a document
> can select a different one by invoking the `mso` request on the
> preferred one.
> 
> I could also extend the `defcolor` request to accept a zero-argument
> form that would erase the internal dictionary of defined color names,
> restoring the state of the formatter in this respect when launched with
> "troff -R".[1]  If one hated colors and wanted to make sure a document
> didn't use them, the "-wcolor" option plus `.defcolor` at the top of a
> document (or in one's "troffrc-end" file), should accomplish that.
> 
> Regards,
> Branden
> 
> [1] It could also be extended to accept a single-argument form that
>     would remove only the named color from the dictionary.
> 
>     I've improved diagnostics in this development cycle.
> 
>     $ echo '.defcolor' | ~/groff-1.23.0/bin/groff -wmissing
>     troff:<standard input>:1: warning: missing identifier
>     $ echo '.defcolor red' | ~/groff-1.23.0/bin/groff -wmissing
>     troff:<standard input>:1: warning: missing identifier
> 
>     $ echo '.defcolor' | ~/groff-HEAD/bin/groff -wmissing
>     troff:<standard input>:1: warning: color definition request expects
> arguments $ echo '.defcolor red' | ~/groff-HEAD/bin/groff -wmissing
>     troff:<standard input>:1: warning: missing color space in color
> definition request

Attachment: HTML-TmacColours.pdf
Description: Adobe PDF document

Attachment: X-TmacColours.pdf
Description: Adobe PDF document

Reply via email to