My apologies. In addition to the typo regarding $color, after reviewing the code I gave you, I realized that I also made a typo in the echo line.
That line should've read
echo %color $1 $+(<,$2,>) $3-
In any case, I'm glad to hear you got a code that works.