[openbeos] Terminal greetings prettying

  • From: "François Revol" <revol@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 28 Feb 2007 01:56:15 +0100 CET

Yes I know it's really not important, but it's a one of those little
details...

I wrote a script to output possible values for a colored "Welcome to
the Haiku shell" msg in the same spirit the Be one did long ago...
matching the colors from our logo.

Maybe our CDTeam has a view on that.
I kinda like the reverse-bold-caps one.

ANSIHLP is a reminder script I wrote long ago to help with those ansi
escapes.

It's really just for the sake of it. :D

On the same topic maybe we should propose a custom .dircolors :)))

François.
#!/bin/sh
echo -e
echo -e "+----------------------------------------------------+"
echo -e "|Codes couleur ANSI :                                |"
echo -e "+----------------------------------------------------+"
echo -e "ESC[xm :"
echo -e "  x =  0     1     2     3     4     5     6     7"
echo -e "      \033[0m abcd \033[0m\033[1m abcd \033[0m\033[2m abcd 
\033[0m\033[3m abcd \033[0m\033[4m abcd \033[0m\033[5m abcd \033[0m\033[6m abcd 
\033[0m\033[7m abcd \033[0m"
echo -e
echo -e "            ------------------------------            "
echo -e "ESC[x;ym :"
echo -e "  x =  40    41    42    43    44    45    46    47"
for cpt in 1 4 7; do
echo -e "y=$cpt   \033[40;${cpt}m abcd \033[41;${cpt}m abcd \033[42;${cpt}m 
abcd \033[43;${cpt}m abcd \033[44;${cpt}m abcd \033[45;${cpt}m abcd 
\033[46;${cpt}m abcd \033[47;${cpt}m abcd \033[0m"
done
cpt=30
while [ $cpt -lt 38 ]
do
echo -e "y=$cpt  \033[40;${cpt}m abcd \033[41;${cpt}m abcd \033[42;${cpt}m abcd 
\033[43;${cpt}m abcd \033[44;${cpt}m abcd \033[45;${cpt}m abcd \033[46;${cpt}m 
abcd \033[47;${cpt}m abcd \033[0m"
cpt=`expr $cpt + 1`
done
echo -e "            ------------------------------            "


#!/bin/sh

print_welc () {
        echo -e "\nWelcome to the 
\033[${SEL}${CG}${AEM}m${HAIKU:0:1}\033[${SEL}${CR}m${HAIKU:1:1}\033[${AN}${AEM}m${HAIKU:2:1}${HAIKU:3:1}\033[${SEL}${CY}m${HAIKU:4:1}\033[${AN}m
 shell.\n"
}

# 
try_msg() {
        # normal
        AN=0
        # emphasize (bold/...)
        AEM="$1"
        # colors
        CG=2
        CR=1
        CY=3
        #FG vs BG
        SEL=3 # fg
        HAIKU="Haiku"
        print_welc
        HAIKU="HAIKU"
        print_welc
        SEL=4 # bg
        HAIKU="Haiku"
        print_welc
        HAIKU="HAIKU"
        print_welc
}


#echo -e "\nWelcome to the \033[32;1mH\033[31ma\033[0;1mik\033[33mu\033[0m 
shell.\n"
#echo -e "\nWelcome to the \033[42;1mH\033[41ma\033[0;1mik\033[43mu\033[0m 
shell.\n"
#echo -e "\nWelcome to the \033[42;1mH\033[41mA\033[0;1mIK\033[43mU\033[0m 
shell.\n"

# ideally should output non-ansi version for dumb or 
!beterm&&!xterm-color&&!linux...
test "x$TERM" != "xbeterm" && echo "Bad term!" 
#
#&& exit 0

echo "The good old faithful original:"
echo -e "\nWelcome to the \033[34;4;1mB\033[31me\033[0m shell.\n"

echo "normal"
try_msg 
echo "bold"
try_msg ';1'
echo "underline"
try_msg ';4'
echo "bold underline"
try_msg ';4;1'

echo "reverse"
try_msg ';7'
echo "reverse bold"
try_msg ';7;1'
echo "reverse underline"
try_msg ';7;4'
echo "reverse bold underline"
try_msg ';7;4;1'


Other related posts: