Colloring Status of process or package

Hi there all again,

I am building a menu script for viewing packages and deamons and printers and all..

I know how to collor text to red or green.
But I get my results from status and put it in a array.
How can I change a result that is standing in a array to build collor around it.
For example

STATE_XCFA[1] can be UP or DOWN
If it is UP I want it to be green and if it is DOWN i want it to be red.

Example so you see where I'm getting at.
Echo "STATUS: ${STATE_XCFA[1]} | STATE: ${STATE_XCFA[2]} | NODE: ${STATE_XCFA[4]}|\n"

Should show as follow

STATUS: UP | STATE: RUNNING | NODE: HPUX006

Or

STATUS: DOWN | STATE: RESTARTING | NODE: HPUX005

Thanx people!

case ${STATE_XCFA[1]} in
     UP) clr=32 ;;
     DOWN) clr=31 ;;
     *) clr=0;
esac
printf "STATUS: \e[${clr}m%s\e[0m | STATE: \e[${clr}m%s\e[0m | NODE: \e[${clr}m%s\e[0m|\n" \
       "${STATE_XCFA[1]}" "${STATE_XCFA[2]}" "${STATE_XCFA[4]}"

which shell are you using?? because what mr.johnson suggested might not work in all shell

My suggestion will work in all Bourne-type shells.

It will not work in some non-standard terminals.

I'm using Korn

This goes together with my other question actually.

So ummmm how do I set this up how you explain it?
I am using korn
I'm on a HP UX System

Put the code I gave you into your script. Adjust it as necessary to conform to your use.

The Korn shell is a Bourne-type shell.