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.

> 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.

Which should be the default for the other devices?

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: signature.asc
Description: PGP signature

Reply via email to