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

Re: [bug] color none vs. default



On Oct 8, 11:27pm, denis wrote:
}
} according to the manpage (zshcontrib) you could reset all
} attributes using the color 'none', but this doesn't work.

You're misreading the documentation.

The second paragraph under "colors" in zshcontrib is providing
background material on ANSI terminal color attributes.  It is NOT
talking about the contents of the arrays or how you use them.  Note
that it begins:  "The eight base colors are: black, red, green,
yellow, blue, magenta, cyan, and white."

Later, under the description of the "fg" array, it says: "Map the
eight basic color names ...".  Notice that "none" is NOT one of the
eight basic color names; there is no $fg[none].

There is, however, $reset_color, which is what you want here.  If you
look at the assignment of $reset_color in the "colors" function def'n,
you'll see that it uses $color[none].

   echo "$fg[red]this is red${reset_color}this is no longer red"

It is true that $fg[default] is undocumented.  The effect of the ANSI
"default color" value is apparently supposed to be to reset the color
without changing other attributes, whereas $reset_color resets all the
attributes.



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