Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What appears to be inconsistent results from ${(%):-%F{${subscript}}
In addition to what Mikael already said ...
On Mon, Mar 4, 2024 at 6:56 AM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> First, '${(%):-%F{${subscript}}' has unbalanced curly brackets({}), but still works.
Because of the "}" effect Mikael described, the prompt expansion here
will be for e.g. "%F{grey" with end-of string instead of closing
brace. That happens to work.
> colorconversion="${(%):-%F{${subscript}}"
You need another set of quotes here, e.g.,
colorconversion="${(%):-"%F{${subscript}}"}"
Double-quotes can be nested when they are inside a nested parameter expansion.
> 1) the color names grey and gray do not output black but output the default
For the Nth time, prompt expansion does not correspond to the names
instantiated by the "colors" function. The "colors" names are for
generating direct output to the terminal, not for populating prompt
strings.
> using decimal numbers(0-255)
> 0 - 15 uses 30-27 and 90-97(bright) instead of using the colors defined
> by the terminal
> Hex codes appear to work as expected.
[...] by a sequence in braces following
the %F, for example %F{red}. In the latter case the values allowed
are as described for the fg zle_highlight attribute; *note
Character Highlighting::.
Numbers 0-7 are interpreted as the names "black","red",...,"white"
Numbers 8-(terminfo maxcolor) are interpreted as the color defined by terminfo
Numbers greater than that are the colors defined by the terminal itself
So the only reliable thing for true-color terminals is to use the hex
codes. This is not really clearly explained under "Character
Highlighting".
Messages sorted by:
Reverse Date,
Date,
Thread,
Author