[FUN] Algorythms and colors.
From: Nabis (nabis_at_nomail.net)
Date: 10/24/04
- Previous message: Heiner Steven: "Top 10 subjects comp.unix.shell"
- Next in thread: William Park: "Re: [FUN] Algorythms and colors."
- Reply: William Park: "Re: [FUN] Algorythms and colors."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 23 Oct 2004 23:26:50 -0500
Hi!
Something a amateur did over a weekend and decided to share :D
You will find a few more on www.freewebs.com/nabis/rgb.html (don't
mind the rest of the site).
I could not figure out how to print hex numbers in bash, also the
html output contains a little error on the sed line, which I did
not care to fix yet.
What I am interested in is new algorythms and shapes. Have fun:
#!/bin/bash
#
# prints the whole spectra of colors. A rainbow.
R=0
G=0
B=0
FILE=$HOME/rgbtest2.html
pre='<span style="background:'
post='border: 1px solid black"> </span>'
echo '<html>
<head><title>Web Colors Bash</title>
</head><body><pre>' > $FILE
up_green()
{
green=0
while [ $green -lt 226 ]; do
echo -n "$pre rgb($1, $green, $2); $post" >> $FILE
let green=$green+6
done
echo >> $FILE
}
B=0
R=225
while [ $R -gt 0 ]; do
up_green $R $B
let R=$R-6
let B=$B+6
done
echo '
<b>Script which generated this page:</b>
' >> $FILE
sed 's/</\</g;s/>/\>/g' $0 >> $FILE
echo '</pre></body></html>' >> $FILE
- Previous message: Heiner Steven: "Top 10 subjects comp.unix.shell"
- Next in thread: William Park: "Re: [FUN] Algorythms and colors."
- Reply: William Park: "Re: [FUN] Algorythms and colors."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|