Colorful Menu

I know how to create a menu using select and case. What i want to know is,how can i create a menu using select and case where the menu options are in colored text?

---------- Post updated at 02:50 AM ---------- Previous update was at 02:42 AM ----------

if the menu options are like:

1) gl35a
2) t2000
3) s531
4) vt99
5) gdjk

I want the numbers (like "1)") in green and the options (like gl35a,t2000 etc) in yellow.

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

$ printf "\033[40;32mGREEN\n\033[m"
GREEN
$ printf "\033[40;33mYELLOW\n\033[m"
YELLOW

Script to generate all colors:

for foreground in 0 1 2 3 4 5 6 7; do
        for bold in '' ';1'; do
            for background in 0 1 2 3 4 5 6 7; do
                color="4$background;3$foreground"
                printf "\033[$color${bold}m $color${bold:-  } \033[m"
            done
            echo
        done
done

Thats nice, can you interactively query the background colour being used and set the foreground to a complimentary colour?

Didn't really get the reply i was looking for?

#! /usr/bin/ksh
clear
echo;echo;echo
printf "\033[40;32m1) \033[40;33mgl35a\033[m \n"
printf "\033[40;32m2) \033[40;33mt2000\033[m \n"
printf "\033[40;32m3) \033[40;33ms531\033[m \n"
printf "\033[40;32m4) \033[40;33mvt99\033[m \n"
printf "\033[40;32m5) \033[40;33mgdjk\033[m \n"
echo
read user_choice
echo  you chose $user_choice

Aditya

I didn't know how to do this but worked it out from the info posted here, why didn't you when people had taken the trouble to help you?