PDA

View Full Version : Nifty Coloured Welcome Message


wafflesausage
April 22nd, 2011, 01:30
Hey, I don't post here often, but I thought I should share a neat little script that I concocted earlier today. Basically what it does is display an "animated" message that can be tacked on to the end of your /etc/rc or in your $SHELLrc. Note that this only works on FreeBSD (as far as I know) and only works with the virtual console, so no xterms.

#!/bin/sh
echo "Welcome to..."
echo -n "F"
vidcontrol blue
echo -n "r"
vidcontrol green
echo -n "e"
vidcontrol cyan
echo -n "e"
vidcontrol red
echo -n "B"
vidcontrol brown
echo -n "S"
vidcontrol white
echo -n "D"

You don't have to use those colours, by the way. To see which colours are available, run vidcontrol show.

vivek
April 27th, 2011, 14:51
I prefer dialog and friends (devel/cdialog) when it comes to fancy stuff for shell scripts.

UNIXgod
April 28th, 2011, 02:42
fun hack!

wafflesausage
April 28th, 2011, 07:31
If you liked that you might also like this:

#!/bin/sh
while [ 0 ]
do


vidcontrol white green
echo -n ""
vidcontrol yellow green
echo -n "
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # "

vidcontrol white
echo -n ""
vidcontrol cyan blue
echo -n " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #"

vidcontrol white
echo -n ""
vidcontrol blue magenta
echo -n " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # "

vidcontrol white
echo -n ""
vidcontrol magenta red
echo -n " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #"

vidcontrol white red
echo -n ""
vidcontrol red brown
echo -n " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # "

vidcontrol white brown
echo -n ""
vidcontrol brown yellow
echo -n " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #"

done

Yeah, it's even less useful, but it's fun to stare at and is useful if you have a need to self induce headaches.
Note: If you're having problems with either of these scripts, comment out any lines that list yellow as the first colour.

Zare
April 28th, 2011, 08:59
Here's the thing I used to do in DOS days for text-mode banners and stuff. Wrote it now in 10 minutes using Perl and ANSI sequences so it should be portable. It'll repaint each letter in $text using every @colours member, nicely animated.


#!/usr/bin/perl

use IO::Handle;
use Time::HiRes qw(nanosleep);

$text = "Welcome to FreeBSD";
@colours = ( 37, 32, 33, 34, 35, 36, 31 );

printf("\033[?25l");

for($i = 0; $i < length($text); $i++)
{
$currentchar = substr($text, $i, 1);
for($j = 0; $j < scalar(@colours); $j++)
{
unshift(@colours, pop(@colours));
printf("\033[%d;40m%s", $colours[0], $currentchar);
printf("\033[1D"); flush STDOUT; nanosleep(150);
}
printf("\033[1C");
}

printf("\n\033[0;0m\033[?25h");