TrueColor (24 bits) support

Marc Lehmann schmorp at schmorp.de
Thu Jul 18 10:51:29 CEST 2013


On Thu, Jul 18, 2013 at 12:38:30PM +0400, Антон Кочков <anton.kochkov at gmail.com> wrote:
> Hm. From the http://lists.suckless.org/dev/1307/16688.html :
> > I've been doing some ansi tests and found that only xterm (not urxvt, vte, iterm2,cmd.exe) supports truecolor ansi escape codes.
> > It is documented in wikipedia, but afaik, only radare2 uses it (when enabled).
> > Do you think that it should be implemented in st or we should stand supporting the most common scenarios?
> > True RGB (24bit color) is constructed like this:
> > \x1b[38;5;R;G;Bm
> > Where 38 is fg (48 is bg)
> > And RGB are decimal (1-3chars) from 0-255
> Best regards,
> Anton Kochkov.

The correct code to use is given by "ccc", "initc" or "initp" in
terminfo. While AFAIK the code is the same in xterm and urxvt, hardcoding
terminal-specific codes is just fail on side of the program - the correct
way is to use terminfo, e.g. via ncurses (which simplifies things
considerably over raw terminfo). That way it works on every terminal that
supports colour. not just xterm and urxvt.

Note that the so-called "true colour ansi escape code" has nothing to do
with true colour nor ansi. Hardcoding such extensions when a portable
mechanism exists is just sloppy coding.

Or in other words, if one writes a program specifically so that it only
works on a specific terminal, then it will only work on that specific
terminal - it will not even work on another terminal with exactly the same
support, because the terminal name will be different.

There is nothing that urxvt can do about such badly written programs. It's
certainly not difficult to use ncurses to do it properly, without
hardcoding specific terminals, and it's certainly not any lack of
truecolour support in other terminals that keeps it form working, it's
just low quality coding in that application.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\




More information about the rxvt-unicode mailing list