zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: true colour support
Date: Tue, 06 Nov 2018 14:37:20 +0100	[thread overview]
Message-ID: <71224-1541511440.931314@XFIZ.XFub.4y-9> (raw)
In-Reply-To: <CAKc7PVBjmnpmghFRteDwymuHcOmo87DgkfULN3f3TiCX_YYjxA@mail.gmail.com>

Sebastian Gniazdowski wrote:
> I'm grepping the patches and cannot find any snippet that decides
> whether to use 24-bit escape sequences or zsh/nearcolor module. How
> it's decided?

The following section of new documentation (in mod_nearcolor.yo) is
intended to cover this:

+In order to use the tt(zsh/nearcolor) module, it only needs to be
+loaded. Thereafter, whenever a colour is specified using a hex triplet,
+it will be compared against each of the available colours and the
+closest will be selected.

On loading, zsh/nearcolor registers a hook function for GETCOLORATTR.
After parsing a hex triplet, match_colour() calls:
  colour = runhookdef(GETCOLORATTR, &color) - 1.
runhookdef() returns 0 if there is no registered handler for the hook
The following line in match_colour() is:
  if (colour < 0) { /* no hook function added, try true color (24-bit) */

> You've also written: "No true colour escapes will ever be generated if
> you don't specify colours as hex triples anyway. And even if they are,
> they should be ignored.".This sounds like: if true-color/near-color
> was not enabled, ignore hex-triplet. But I think there is no switch
> (e.g. an option) to enable true-color support?

You don't need to do anything to enable true colour. It is the
default when you specify colours as a hex triplet. With the text
you quoted, I was trying to justify this decision by pointing out
that there are no backward compatibility concerns - any existing
setup that only uses the old forms - %F{blue}, %K{123} etc - will
work exactly as before (no true color escape codes are ever generated).

But before introducing colours specified as hex triplets in their
configuration, users may want to take care to either load zsh/nearcolor
or use a terminal that supports true colour.

Feel free to suggest improvements to the documentation.

Oliver

  reply	other threads:[~2018-11-06 13:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKc7PVCEmTTMRR0P3kx9ktpLDBYqJ+MRsE77UMLFjonEZAixfA@mail.gmail.com>
2018-10-30 23:41 ` Terminal theme tool – a workaround for lack of 24-bit color in Zsh? Oliver Kiddle
2018-11-01 18:42   ` dana
2018-11-04  1:42   ` PATCH: true colour support Oliver Kiddle
2018-11-04 22:57     ` Oliver Kiddle
2018-11-05 14:36     ` Sebastian Gniazdowski
     [not found]       ` <46482-1541429525.040210@53iC.Cv7F.M2xE>
2018-11-05 15:48         ` Sebastian Gniazdowski
2018-11-05 16:22           ` Sebastian Gniazdowski
2018-11-06 12:12     ` Sebastian Gniazdowski
2018-11-06 13:37       ` Oliver Kiddle [this message]
2018-11-06 21:46         ` Sebastian Gniazdowski
2018-11-06 12:22     ` Should there be a Zsh release for true-color support to adopt earlier? Sebastian Gniazdowski
2018-11-06 22:35       ` Daniel Shahaf
2018-11-06 23:46         ` Bart Schaefer
2018-11-05 14:03   ` Terminal theme tool – a workaround for lack of 24-bit color in Zsh? Sebastian Gniazdowski
2018-11-15 11:50   ` Jun T
2018-11-15 12:44     ` Peter Stephenson
2018-11-16  7:54       ` Jun T
2018-11-19  8:29         ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71224-1541511440.931314@XFIZ.XFub.4y-9 \
    --to=okiddle@yahoo.co.uk \
    --cc=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).