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