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

Re: Just for fun



On Thu, Oct 16, 2008 at 08:05:47AM -0700, Bart Schaefer wrote:
> A long time ago Alan Third posted the following function to zsh-users.
> Anyone want to have a stab at updating it to use the new prompt coloring
> code for better accuracy?
> 
> function most_useless_use_of_zsh {
>     local lines columns colour a b p q i pnew
>     ((columns=COLUMNS-1, lines=LINES-1, colour=0))
>     for ((b=-1.5; b<=1.5; b+=3.0/lines)) do
>         for ((a=-2.0; a<=1; a+=3.0/columns)) do
>             for ((p=0.0, q=0.0, i=0; p*p+q*q < 4 && i < 32; i++)) do
>                 ((pnew=p*p-q*q+a, q=2*p*q+b, p=pnew))
>             done
>             ((colour=(i/4)%8))
>             echo -n "\\e[4${colour}m " 
>         done
>         echo
>     done
> }
[...]

I don't know of the new prompt colouring code, but the only way
I can see this "improved" would be using echoti setab $colour,
and maybe adapt it based on $terminfo[colors] to use more
colours where available (16, 88 or 256 as on most /recent/
X11 terminals).

-- 
Stéphane



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