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

Re: Supporting %F{...} and %K{...} in Zsh 4.x



On Sun, Dec 17, 2023 at 12:51 PM Grant Taylor <gtaylor@xxxxxxxxxxxxxxxxxx> wrote:

I guess I could set the color codes in variables and use the variables.

Functions/Misc/colors from 5.9 (and even from git HEAD, currently) is backward-portable to 4.2.x (again, tested on 4.2.6).

This may be useful:

coloresc() {
  local codes=$(printf "%s;" ${(e):-\$\{color\["$^@"\]?oops\}})
  REPLY=$'\e['"${codes%;}m"
}

Used like
  coloresc bg-bright-blue bold white
it sets $REPLY to the escape sequence for the listed color combination.




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