[FUN] Algorythms and colors.

From: Nabis (nabis_at_nomail.net)
Date: 10/24/04

  • Next message: ray: "Need help writing a script"
    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/</\&lt;/g;s/>/\&gt;/g' $0 >> $FILE
    echo '</pre></body></html>' >> $FILE


  • Next message: ray: "Need help writing a script"

    Relevant Pages

    • Re: [FUN] Algorythms and colors.
      ... Nabis wrote: ... > Something a amateur did over a weekend and decided to share:D ... > mind the rest of the site). ... > I could not figure out how to print hex numbers in bash, ...
      (comp.unix.shell)
    • Re: Sector General Again
      ... permission for online reading (with some amateur illustrations ... published around when the movie _Superman II_ came out. ... weirdly hybridize the Superman's LSOK history with some of the ... good as LSOK to my mind, ...
      (rec.arts.sf.written)
    • Re: Seriously Nice Young Horse
      ... I love Just The Best - amateur ... mind in a pretty and athletic package. ... Dennis is in your neighborhood at the moment. ...
      (rec.equestrian)
    • Buttons in forms
      ... through this bearing in mind I ... am a complete amateur in the world of VB, ... Kevin Sprinkel ...
      (microsoft.public.access.forms)
    • Re: Cheap rechargable batteries
      ... The topic was SPECIFICALLY amateur use, ... The topic WAS Li batteries, ... some planes draw more) and occasionally ... I'll bear that in mind. ...
      (uk.rec.cycling)