2

From fbterm(1) we can read:

FbTerm supports xterm's 256 color mode extension.  (...)  But xterm's 256 color escape sequences conflict with the linux sequences implemented by FbTerm, so private escape sequences were introduced to support this feature:

   ESC [ 1 ; n }                   set foreground color to n (0 - 255)
   ESC [ 2 ; n }                   set background color to n (0 - 255)
   ESC [ 3 ; n ; r ; g ; b }       set color n to (r, g, b) , n, r, g, b all in (0 - 255)

How can these escape sequences be written with the command echo -ne?

merryup
  • 21

1 Answers1

2

You can use e.g.

echo -ne "\E[2;32} "

which should print a blue space. (32 is the 32nd colour in the default 8-bit colour table which seems to be blue.)

(Of course you can also use \x1b or \033 instead of \E to represent the escape character.)

To view all 255 colours you can use for i in {0..255}; do echo -ne "\E[2;$i} "; done; tput sgr0; echo or for i in {0..255}; do echo -ne "\E[2;$i}$i "; done; tput sgr0; echo which also includes the number of the colour.

Example: colour output example captured with fbgrab from framebufferconsole

Kai
  • 33