Re: man-pages input, how to forward esc seq to tty output dev

"G. Branden Robinson" <[email protected]>
Newsgroups gmane.comp.printing.groff.general
Message-ID <20251115100718.5ixujstrjunntva6@illithid>
Hi Phi,

At 2025-11-15T08:49:09+0100, Phi Debian wrote:
> I got a tool producing man-pages, i.e page that will be displayed by
> man(1) on tty device UTF8 capable with SGR's (namely vt100 emulator)
> 
> In my generated man-page (that will feed groff...grotty) I'd like to
> be able to emit ledgit escape sequence (again when in tty mode) but I
> can't find a way to emit the exact color I need. (Or other attributes)
> 
> Is there any advise.
> 
> So far I tried
> Here is text in \*[red]red\*[], \*[green]green\*[], and \*[blue]blue\[].
> 
> But I never get it either with
> man -l foo.1
> groff -man -Tutf8 -c foo.1

Nothing defines strings named `red`, `green`, or `blue` by default.
You'll have to do so yourself, or use a different escape sequence to
access these color names, which are defined in a different name space.

The grotty(1) man page has an extensive example.

Examples
     The following groff document exercises several features for which
     output device support varies: (1) bold style; (2) italic
     (underline) style; (3) bold‐italic style; (4) character composition
     by overstriking (“coöperate”); (5) foreground color; (6) background
     color; and (7) horizontal and vertical line drawing.

            You might see \f[B]bold\f[] and \f[I]italic\f[].
            Some people see \f[BI]both at once\f[].
            If the output device does (not) co\z\[ad]operate,
            you might see \m[red]red\m[].
            Black on cyan can have a \M[cyan]\m[black]prominent\m[]\M[]
            \D'l 1i 0'\D'l 0 2i'\D'l 1i 0' look.
            .\" If in nroff mode, end page now.
            .if n .pl \n[nl]u

     Given the foregoing input, compare and contrast the output of the
     following.

            $ groff -T ascii file
            $ groff -T utf8 -P -i file
            $ groff -T utf8 -P -c file | ul

Notice the `\m` and `\M` escape sequences.

You might want to avoid going through man(1) if you're using colors;
I've read that some implementations deliberately introduce an SGR
stripper to the rendering pipeline.

Regards,
Branden
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmkYUM8ACgkQ0Z6cfXEm
bc7/+g/9GhU27/jG5lURnbBDVGO1iC1bIBnF8MWOV5yz4lf62xsHydMIkW0Q7Tww
bGS2NB4ddLdVmIs+ome5bkEVsGneRvGgRPBTViy7Q4zB17QEIUfU1rI9o8e8XHPR
1SyvEE6E9+L3bXZBFEI2K2qAS6cElGnkpu619Sfov6yfQfFlRPk74YQBVU+U2u/V
1XpcQ07QBAg1OT0bGTYGT1yZm3FghN4uhTh2S/b1yb1YdKbu3josy7SbGhaqxyRh
JW57F6EloWlaGDHyvgarsgG361lZBRKEIuwPIbOXUVJi6IfFoAsLMl9cAlpNbe5m
PYvspZYFCl1tzv3tz+fzuBSB7qUkKc0/LVemw1Mo4/NB5jiYjCmAdVdrx3GCm/eZ
hJMmte7pd+rUxhNLfitXEL5+sJCIaV2PrrDC+94Bv9T1BxUYHMA9ieeliuomUSE0
N1sDxVqSCa+sh3xYALF+ue7WiNFrJStXUNOxLuyqRe2YtxWl88ccpFG7RBG+ildo
mE5vBF5J5xOXNBQSdtBtl1dGjGEF9cbowmibOzhfCgYth0INBEptsUrvei0ZSxlP
jWknVtOUdj8StwXNPOtK4F01p3ZzRS5YOOo8prfigzJAEWD6w1WmBXGgQ0YHTJfb
+QATB1pegckgmDaNASZCEjlotk6kja8ZY/o0pIlYt5wD5ZxOZfQ=
=FOkG
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.