bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Usage of of init_extended_color


From: Thomas Dickey
Subject: Re: Usage of of init_extended_color
Date: Sun, 18 Mar 2018 13:07:21 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Mar 18, 2018 at 03:58:21PM +0000, Roger Pau Monné wrote:
> Hello,
> 
> I'm looking into modifying a ncurses based application so it can make
> use of more than the default 256 color xterm palette, but I'm having
> some issues figuring out how to do that. The terminal I'm using
> supports truecolor and has COLORTERM=truecolor set in the environment.

hmm - start here
https://invisible-island.net/ncurses/ncurses-slang.html
https://invisible-island.net/ncurses/ncurses-slang.html#cause_environ
https://invisible-island.net/ncurses/ncurses-slang.html#env_COLORTERM
 
> I need to keep support for the already existing xterm-256 color
> palette, so AFAICT the 0..255 color values cannot be modified in order
> to keep existing users. I though that using the new
> init_extended_color would allow me to define color values > 255, but

Not exactly.  Essentially you're talking about "indexed color", which
is different from "direct color" (which some people ironically insist
on calling "true color").

Indexed color uses a palette, i.e., a set of colors from which you
can select a particular one using an "index".  The maximum size of the
palette is implementation-specific.  In theory, that could be "any"
practical size, but in practice xterm uses 256 because it is convenient
(and other developers have chosen to copy xterm's behavior rather than
demonstrating a useful program with a larger palette).

Direct color (again, the sizes are implementation-specific), would
provide a way to represent the colors in the palette used for indexed
color, and you _could_ map from indexed-color to direct-color.  But
ncurses won't do that mapping for you: it's not general enough to
be useful to more than a small niche, though it's a trivial exercise
for a developer.

This program does it, for instance:

https://invisible-island.net/ncurses/ncurses-slang.html#compare_picsmap

> that doesn't seem to work. COLORS is still 256, and trying to define
> any color value greater than 255 doesn't work.
> 
> Is there anything that should be done in order to expand the number of
> available color values beyond 256?
> 
> How should more colors be added without overwriting the ones in the
> xterm-256 system palette?

-- 
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]