Wednesday, June 6, 2012

Re: max colors in text based terminals

On Tue, Jun 05, 2012 at 05:50:45AM EDT, Thomas Dickey wrote:
> On Jun 5, 3:00 am, Chris Jones <cjns1...@gmail.com> wrote:

[..]

> xterm looks for 5 ("38;5"), that's documented and well-known.

My understanding is that the "38;5" and the "38;2" have different goals:

From Konsole's README.moreColors:

| The konsole adopted some ESC codes allowing to use extended
| color spaces.
|
| There is a predefined 256 color space compatible with his
| xterm sister, and, even beyond that, a 3-byte RGB color space.
|
| The ESC codes are as follows:
|
| ESC[ ... 38;2;<r>;<g>;<b> ... m Select RGB foreground color
| ESC[ ... 48;2;<r>;<g>;<b> ... m Select RGB background color
|
| ESC[ ... 38;5;<i> ... m Select indexed foreground color
| ESC[ ... 48;5;<i> ... m Select indexed background color

> Is konsole's format documented anywhere except for a comment in the
> code?

| https://github.com/robertknight/konsole/blob/disable-wordwrap/user-doc/README.moreColors

Robert Knight appears to have been the Konsole's main dev' -- c. 2008.

> 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.

I eventually downloaded Kubuntu 12.04 and ran the following commands:

| for i in $(seq 0 255); do echo -e -n "\033[38;2;${i};0;0m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;0;${i};0m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;0;0;${i}m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;${i};128;128m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;128;${i};128m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;128;128;${i}m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;${i};192;192m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;192;${i};192m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;192;192;${i}m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;${i};224;224m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;224;${i};224m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;224;224;${i}m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;${i};64;64m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;64;${i};64m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;64;64;${i}m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;${i};32;32m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;32;${i};32m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;32;32;${i}m█"; done; echo
| for i in $(seq 0 255); do echo -e -n "\033[38;2;255;255;${i}m█"; done; echo

Since many people don't have Konsole installed on their system, I took
the liberty of attaching a (small) screenshot of the output.

There are clearly more than 256 colors concurrently displayed.

Not included in the screenshot, I ran the equivalent of 256color2.pl in
between each of the above commands, just to make sure that Konsole's
default 256-color palette was unaffected.

CJ

--
ALL YOUR BASE ARE BELONG TO US!

--
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: