Colorful Menu

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Colorful Menu
# 1  
Old 10-20-2009
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.
# 2  
Old 10-20-2009
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 [code] and [/code] 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
# 3  
Old 10-20-2009
$ printf "\033[40;32mGREEN\n\033[m"
$ printf "\033[40;33mYELLOW\n\033[m"

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
                printf "\033[$color${bold}m $color${bold:-  } \033[m"

# 4  
Old 10-20-2009
Thats nice, can you interactively query the background colour being used and set the foreground to a complimentary colour?
# 5  
Old 10-21-2009
Didn't really get the reply i was looking for?
# 6  
Old 10-21-2009
#! /usr/bin/ksh
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"
read user_choice
echo  you chose $user_choice


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?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome. Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies

2. UNIX for Beginners Questions & Answers

Colorful message is displayed in the terminal but not in the log file

Is there any way to print the colorful message in the terminal (which is the output of a simulation) to the log file with the same color. The colorful message at the terminal is obtained by the following codes: /////////////codes start here/////////////////////////////////////// ... (5 Replies)
Discussion started by: babunp114525
5 Replies

3. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

4. Shell Programming and Scripting

Menu with sub-menu options

Hi! I have created on script which is working fine with menu options and with a sub-menu. I want to enhance it by using sub-options under menu options. Like. option 1) will give the list only. option 1.1) should give the option to user to choose one file, whose content user wanna see. ... (3 Replies)
Discussion started by: sukhdip
3 Replies

5. Shell Programming and Scripting

How to send colorful text and attachment to mail

Hi, I want to send color text as body of mail with multiple attachments.How to do this?I used sendmailcommand but this command fails for multiple attachments.Give me some solution on this. :wall: (0 Replies)
Discussion started by: AhmedLakadkutta
0 Replies

6. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

7. Shell Programming and Scripting

Some colorful progress bars

Hi Folks, I've been playing around implementing some colorful progress bars using shell scripting. I thought it would nice to share my work :) If you like em, feel free to use em :D Cheers #!/bin/sh # # Simulate a progress bar with colors # Author: Sofiane Cherchalli... (1 Reply)
Discussion started by: sofianito
1 Replies

8. Shell Programming and Scripting

Get a value from menu.

Hi, I have a shell-script (in bash) wich read from a file this: 1 Telediario 1 2009012609000 2 Mira quien baila 2009012511000 3 No mas 2009012603000 ..... ..... 12 Quiero ser tu 20090127113000 13 Al igual que 20090127130000 ........ (2 Replies)
Discussion started by: mierdatuti
2 Replies

9. Linux

how to make text colorful in vi editor in fedora core 6

how to make texts colorful in vi editor in fedora core 6. (1 Reply)
Discussion started by: useless79
1 Replies
Login or Register to Ask a Question