Re: [dev] [dvtm] Truecolor support

From: <>
Date: Wed, 29 Oct 2014 21:34:07 +0100

> Ok as far as I can tell there are two unrelated issues involved (feel
> free to correct me):
> 1) being able to use many colors (possibly all 2^24) at the same time
> 2) being able to set some of the used colors to RGB values
> The first is not easily possible with ncurses. As you probably know
> curses works based on color pairs. That is before the desired fore
> and background color can be used it has to be associated to a color pair
> (with init_pair(3)).

My knowledge about curses is small, I usually stop in terminfo, but I
think you are right and traditional curses only work with pairs

> However pre ABI version 6, or more specificly if
> ncurses is not compiled with --enable-ext-colors only 256 color
> pairs (= different combinations of fore and background colors) an be
> used at the same time.

From the point of view of the terminal, it is only to have a bigger
table for the pallete. The parser, escape sequences and all the logic
is the same for 16 or 256 colors. The only problem may be that some
non legal sequences become legal now.

> Therefore dvtm maintains a mapping of (fg,bg) -> color pair. A LRU
> strategy is employed to reuse the color pairs.

If you want to be totally compatible with terminfo and curses, it is
the only way (and it is really painful).

> However I believe the OP wants option 2). This could probably be
> achieved by using init_color(3) and maintaining some sort of mapping
> from (fg-rgb, bg-rgb) -> color pair. Or probably better using 2 such
> mappings (r,g,b) -> color number and (fg, bg) -> color pair.

With option 2 you can define in each moment what is the RGB
components for foreground and background, because you specify
not the index position but the RGB components for background
and foreground. The problem, you cannot do it in a standard

Received on Wed Oct 29 2014 - 21:34:07 CET

This archive was generated by hypermail 2.3.0 : Wed Oct 29 2014 - 21:36:08 CET