Tuesday, June 5, 2012

Re: max colors in text based terminals

On Jun 5, 3:00 am, Chris Jones <cjns1...@gmail.com> wrote:
> On Mon, Jun 04, 2012 at 08:35:18PM EDT, Thomas Dickey wrote:
> > On Jun 4, 4:00 pm, Chris Jones <cjns1...@gmail.com> wrote:
> > > All the same, I'd be curious to know what the Konsole developers had in
> > > mind when they implemented 16M colors support .
>
> > konsole implements the xterm256-color controls (256 * 256 * 256).
> > It's not 16M * 16M * 16M.
>
> My impression was that xterm lets you specify 256 colors using the
> #000000 .. #ffffff syntax.. in effect letting you override the defaults
> and define a custom 256-color palette chosen among the possible 16M..

yes - but see below

> I became curious about Konsole supporting true color so I booted an iso
> that ships it and ran the following bash commands:
>
> | g=0
> | b=0
> |
> | for r in $(seq 0 255)
> |   do
> |     echo -e "\033[48;2;${r};${g};${b}m $r $g $b"
> |   done
>
> If saw what definitely looked like a gradient that went from pure black
> to the brightest red with 256 intermediate shades of red.
>
> I ran the same script on an xterm(debian stable v261-1) and afaict it
> did not understand the above syntax: the background color remained the
> original default black.
>
> Is this something you enable at './configure' time.. or is xterm's
> syntax different from Konsole's..?
>
> Back on Konsole, I tried a similar script that goes through all 16M
> color combinations:
>
> | for r in $(seq 0 255)
> |   do
> |     for g in $(seq 0 255)
> |       do
> |         for b in $(seq 0 255)
> |           do
> |             echo -e -n "\033[38;2;${r};${g};${b}33m█████████"
> |           done
> |       done
> |   done
>
> This seemed to work as well, but the output was so large that I can't be
> sure I was really getting 16M colors. Even with the smallest font
> I could find, no way I could display it all on one screen. I guess I'd
> have to come up with something a little smarter.

xterm looks for 5 ("38;5"), that's documented and well-known.
Is konsole's format documented anywhere except for a comment in the
code?
(I can read the source code - not many comments there - I do see some
TODO's
suggesting that someone document the color behavior).

What you're describing is a built-in algorithm for the color palette.
Reading the code, I see its behavior for 256-colors is also hardcoded,
which means that it cannot set any of the palette entries. So konsole
implements no more than half of the xterm feature.

The other terminals (starting with xterm of course) allow an
application to set colors.
vte-based stuff is closer to konsole in this regard (a bug report
states that the
display is not updated after changing the palette), so I suppose vte-
based stuff will
sooner or later "implement" this detail.

> In any case, my point was that I don't see this feature as something
> very useful.. unless you want to develop for Konsole exclusively using
> hard-coded escape sequences.
>
> As expected, I didn't see a terminfo entry that had 'colors#16777216'
> and 'pairs#281474976710656'...

There won't be (binary terminfo stores 16-bit numbers, and given the
tradeoffs,
it's unlikely there'll be significant demand for a new/incompatible
format).

> That's why I was wondering what the Konsole developers were planning to
> do with this feature and went to the trouble of coding it.

proof of concept, perhaps. Or hard-coded applications. It took
someone
an afternoon to code - no "trouble" involved.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment