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

Re: prompt colors bug? also possible feature add




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?
That is for someone who knows more about this than I do.

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

I commented out my prompt code in my .zshrc file.
Opened a new terminal.

% unset fg bg fg_bold  # cleared all colors associative arrays
% print -- ${fg[yellow]}This is a test  # outputs the terminal's default color not yellow

Initiated prompts:
% autoload -Uz promptinit && promptinit
% prompt adam2

Ran several tests using:

% prompt_preview_theme fade <color1> <color2> <color3>

Substituted different color names for <colorN>

Prompt outputs all colors as defined in prompt.c.
Did not include gray/grey.

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 ...
The linux console will output colors 0..15
All virtual terminals(that I tested) outputs all 256 colors:  0..255

Anyway, just passing on what I found.

Regards,

Jim





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