Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Support for 256 colors in zsh/curses
- X-seq: zsh-workers 38357
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Support for 256 colors in zsh/curses
- Date: Fri, 29 Apr 2016 13:35:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=cvQuF0a7gkA5VN5xLDkAlKXBKTMUff5gnDMEmlw8o9I=; b=FAy0q9rS8bcxsllYkTmbhNYxiCSpdaeVx8bEDAkzFShPZBTNZ6SPeeW8xWfvwPK16t Q1Vjx7unpA6uzsRtqfSMlnTR0UX2qceoAFm3Gfjw/3OKT0S5Awg1VfTmnz9TBCb7djoy 8rQlsGnHuMzvPnvClwQJ7lwNVonnI87KkOtSjyNoHCP4YArssy5CWaeSqEY+7EYLi5m8 MmEXbOFXLXnf89zj/SW0N8bi9swhFxLF2D5STTaEgO51t8rTDBgrVM8SBNudoGwfE8WU C6Y9Z0dX2MJSyRnDwvacGP+keV7OqgUHf4wJ5T0LugqNsixlPR0dNQyxko31y5JV1u3x aFeg==
- In-reply-to: <CAKc7PVDAUh=he-N+s1ZSGS8JfuCJ+66EB+bpkmOBhFaKXX-k=A@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVDAUh=he-N+s1ZSGS8JfuCJ+66EB+bpkmOBhFaKXX-k=A@mail.gmail.com>
The "a/b" should be "x/y", so:
Hello,
the existing infrastructure in zsh/curses is quite nice. If user
requests color pair "x/y", it is first looked up in a hash table:
!(cpn = (Colorpairnode) gethashnode2(zcurses_colorpairs, colorpair))) {
if it doesn't exist, then "x/y" (e.g. "red/black") is translated to
corresponding integers, and init_pair is called:
if (next_cp >= COLOR_PAIRS || init_pair(next_cp, f, b) == ERR) {
where "f" and "b" are the translated integers. The color pair is put
into the hash under "x/y" for future reuse.
On 29 April 2016 at 13:34, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> the existing infrastructure in zsh/curses is quite nice. If user
> requests color pair "a/b", it is first looked up in a hash table:
>
> !(cpn = (Colorpairnode) gethashnode2(zcurses_colorpairs, colorpair))) {
>
> if it doesn't exist, then "x/y" (e.g. "red/black") is translated to
> corresponding integers, and init_pair is called:
>
> if (next_cp >= COLOR_PAIRS || init_pair(next_cp, f, b) == ERR) {
>
> where "f" and "b" are the translated integers. The color pair is put
> into the hash under "x/y" for future reuse.
>
>
> To support 256 colors, all I had to do is translate num1/num2 into
> f=num1, b=num2, i.e. just directly (classic atoi) translate color
> number into integer to be passed to curses as its color number. Not
> sure what else can I write, reading the code will reveal how
> transparent the change is. Any questions maybe?
>
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author