Where can I find documentation about GNU/Linux TTY formatting

1

1

On gnu.org site there is GNU Head that can be display on terminal it have XTerm compatible (Normal documented ANSI Codes) but it also contain TTY version (it work on Cygwin, didn't test in XTerm or real terminal).

It contain text like:

]Pf767676[1;37mâ]Pf9e9e9e[1;37mâ]P7bcbcbc[47m]Pfeeeeee[1;37mâ]

it have \x1b then ]Pf767676 and then normal [1;37m which is documented for instance on wikipedia. What is ]Pf767676 and where it's documented?

jcubic

Posted 2013-07-22T10:40:37.620

Reputation: 1 533

Answers

2

For Linux console specifically, there is the console_codes(4) manual page. It lists the sequences inherited from VT102, ECMA-48, DEC, and several private ones.

For example, all sequences starting with ESC [ (shorthand CSI) are documented under "ECMA-48 CSI sequences"; they also work the same way on all terminals (or don't work at all).

On the other hand, ESC ] (shorthand OSC) sequences are private to each terminal, and their documentation in this manpage is scattered in various places; ESC ] P is described as:

       ESC ]     OSC      (Should be: Operating  system  command)  ESC  ]  P
                          nrrggbb:  set  palette,  with parameter given in 7
                          hexadecimal digits after the final P :-(.  Here  n
                          is  the  color  (0-15),  and  rrggbb indicates the
                          red/green/blue values (0-255).   ESC  ]  R:  reset
                          palette

In other words, the sequence ESC ] P f 767676 makes the 15th color in the pallete to be hexadecimal #767676.

user1686

Posted 2013-07-22T10:40:37.620

Reputation: 283 655

So in ]Pf767676[1;37m f (15th) change 46 Cyan background (counting from 30) to #767676 or it set color to pick with that 37? – jcubic – 2013-07-22T12:07:56.387

@jcubic: In the Linux console, you directly deal only with an 8-color palette, 0–7 mapping to codes 3037. The other 8 colors are actually used for "bold" versions of the same codes; i.e. 1 + 30 will select the 8th color instead of 0th. Similarly, 1;37 selects the 15th color. (There exist sequences for a true 16-color palette, but they aren't widely supported, and usually not in terminals that allow modifying the palette at all.) – user1686 – 2013-07-22T13:16:18.633