rares_dumitrescu
asked on
Bash dialog menu - colors
hello,
how can i put colors in dialog menus?
dialog --title "some title" \
--menu "\n Use arrows - UP/DOWN \n\
Press [Enter] to select\n" 20 40 10 \
"1" "Choose the psybnc port"\
how can i make 'Choose the psybnc port' green or something ?
thanx
how can i put colors in dialog menus?
dialog --title "some title" \
--menu "\n Use arrows - UP/DOWN \n\
Press [Enter] to select\n" 20 40 10 \
"1" "Choose the psybnc port"\
how can i make 'Choose the psybnc port' green or something ?
thanx
if you are on an ANSI terminal, try inserting <escape>[32m to turn on green <escape>[0m to turn off colours
ASKER
dialog --title "EvoPanel - getmuh v1.5" \
--menu "\n Use arrows - UP/DOWN.\n\
Press [Enter] to select.\n" 21 45 10 \
"GO" "<escape>[32mStart installation"\
But it does not work .. it does not change the collor :|
--menu "\n Use arrows - UP/DOWN.\n\
Press [Enter] to select.\n" 21 45 10 \
"GO" "<escape>[32mStart installation"\
But it does not work .. it does not change the collor :|
What does it do
How did you insert the <escape> character?
How did you insert the <escape> character?
ASKER
sorry i am bothering you so much, i am learning this things on the way
i am writing this scripts in ssh (putty) so .. how should i insert <escape>[32m ?
thanx
i am writing this scripts in ssh (putty) so .. how should i insert <escape>[32m ?
thanx
perl -i -pe 's/<escape>/\e/g' script
would convert "<escape>" strings in script to escape characters (which I can't cut and paste into this comment
would convert "<escape>" strings in script to escape characters (which I can't cut and paste into this comment
ASKER
that perl -i -pe .. made the script like this:
"GO" "^[[32mStart installation"\
so the <escape> was converted into ^[ .. but it still didn't change the color, when i execute it it just appears ^[[32mStart installation
"GO" "^[[32mStart installation"\
so the <escape> was converted into ^[ .. but it still didn't change the color, when i execute it it just appears ^[[32mStart installation
ASKER
anyone ? :D
Do you have the dialog man page? I.e. do you get useful output from the command "man dialog"? Even if not, you can probably fina a man page from Google.
Dialog implements ANSI colours using embedded "\Z" sequences. You need to ensure the terminal type you set in the remote host matches putty's emulation.
Dialog implements ANSI colours using embedded "\Z" sequences. You need to ensure the terminal type you set in the remote host matches putty's emulation.
ASKER
yea, but i still want an answer on how to set collors :)
The man page tells you how to do it - you should try reading it :)
In brief: include the option '--colors" on the command line. Then, to set the colour of a string, e.g. "\Zb\Z1" makes the following text bright red.
RTFM!
In brief: include the option '--colors" on the command line. Then, to set the colour of a string, e.g. "\Zb\Z1" makes the following text bright red.
RTFM!
When reading the man page, you can save yourself some time by searching for the string "color"
dialog --title "some title" \
--menu "\n Use arrows - UP/DOWN \n\
Press [Enter] to select\n" 20 40 10 \
"1" "\Z2\ZZbChoose the psybnc port\Z0\ZB"\
--menu "\n Use arrows - UP/DOWN \n\
Press [Enter] to select\n" 20 40 10 \
"1" "\Z2\ZZbChoose the psybnc port\Z0\ZB"\
ASKER
it does not work :(
OK I actually tried this one. The message colour is set by the number after the 2nd \Z- 2 for green as you originally suggested
dialog --colors --title "some title" --menu "\n Use arrows - UP/DOWN\n Press [Enter] to select\n" 20 40 10 "1" "\Zb\Z2Choose the psybnc port\Zn "
dialog --colors --title "some title" --menu "\n Use arrows - UP/DOWN\n Press [Enter] to select\n" 20 40 10 "1" "\Zb\Z2Choose the psybnc port\Zn "
ASKER
i dont know why, but the script does not work with --colors
the sistem is FreeBSD ..
the sistem is FreeBSD ..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
and if it is .. how ?