Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: prompt colors bug? also possible feature add



On Tue, Sep 19, 2023 at 6:15 PM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> On Wed, Aug 23, 2023 at 10:45 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>> On Wed, Aug 23, 2023 at 5:42 AM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>> >
>> > The more I look into "functions/Prompts" and especially *fade and fire there is no
>> > change in color intensity or the use of "gray".
>>
>> prompt_fade_setup:    prompt_preview_theme fade white grey blue
>> prompt_bigfade_setup:    prompt_preview_theme bigfade red white grey white
>>
>> "colors" defines "grey" so as not to break those preview defaults, and
>> defines "gray" because some people spell differently.
>>
>> > When grey is
>> > specified, the color defaults to the default color of the virtual terminal you are using.
>>
>> I think that's because the virtual terminal is overriding "black".
>> Both gray and grey are defined as being identical to black.  Only the
>> xterm extended "bright" variants are actually gray.
>
> First, I'm no C programmer so I could have missed something. I knew enough C to allow
> me to be a Unix/Linux system administrator and install patches and to occasionally gen
> my own patch, when needed. Looking through prompt.c I find the following:
>
> /* Defines standard ANSI colour names in index order */
> static const char *ansi_colours[] = {
>     "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white",
>     "default", NULL
> };
>
> Grey/gray aren't defined as far as "I" can tell, anywhere. Should it?

You keep changing the context of the discussion.  Everything you
excerpted from my previous message is about prompt themes and the
colors function.  I keep repeating that this has nothing to do with
the C code / the built-in prompt coloring.  The colors function
defines fg[grey] fg[gray] bg[grey] bg[grey] etc.

> But what is more interesting, it appears that prompt doesn't depend on
> the "colors" function.

We're confusing things again.  No, the built-in prompts do not depend
on the colors function.  Also no, the prompt themes typically do not
require the colors function.  In fact the only one that pretends to is
mine (prompt bart) and only because it presumes the fg array might
already exist.  However, many of the themes accept parameters, and you
can use the arrays created by the colors function to get those values.

> What is also interesting, prompt can output all colors defined by "number"
> instead of a color name. e.g. 1 for red 9 for bright-red ...

Exactly, which is why you can use $color[grey] or
$color[bg-bright-red] to get a number.  But that number is the same
for grey and gray as $color[black].




Messages sorted by: Reverse Date, Date, Thread, Author