Yale University School of Art
1156 Chapel Street, POB 208339
New Haven, Connecticut, 06520-8339
(203) 432-2600

Letters Numbers Morse code
<html>


    <head>
        <style type="text/css">
            p {
                font-family: courier;
                color: #000000;
                font-size: 12;
            }

            p.pattern {
                font-family: verdana;
                color: #ffffff;
                letter-spacing: 8px;
                line-height: 70px;
                font-size: 20;
                font-weight: bold;
            }
        </style>
        <title>
        FreePatterns
        </title>
    </head>
        
        
    <body border=0 cellspacing=0>

        
        <form action ="laurenf_02_orig.php">
            <p class="labels">
                letter <input type="text" name="letter1"/>

                number <input type="text" name="letter2"/>

                <input type="submit" value="Pattern"/>
            </p>
    
        <p>
        <hr/>
        </p>
        </form>
        <p>
        
        
    <?php
        $x 
$_REQUEST["letter1"];
        
$y $_REQUEST["letter2"];

        
        
$h $y;
        
// $j = $y +10;
        
    /*    if ($y = "a") {
            $h = 1;
        } */
        


        
            //Convert hsv to rgb
            
function hsv2rgb($hsv) {
                
                list(
$h$s$v) = $hsv;
            
                
$h $h 360;
                
$s $s 100;
                
$v $v 100;
            
                if(
$s == 0) {
                    
$r $v 255;
                    
$g $v 255;
                    
$b $v 255;
                }
                
                else {
                    
$h $h 6;
                    
$i floor($h);
                    
$v1 $v * ($s);
                    
$v2 $v * ($s * ($h $i));
                    
$v3 $v * ($s * (- ($h $i)));
            
                    if(
$i == 0) {
                        
$r $v;
                        
$g $v3;
                        
$b $v1;
                    }
                  
                    elseif(
$i == 1) {
                        
$r $v2;
                        
$g $v;
                        
$b $v1;
                    }
                  
                    elseif(
$i == 2) {
                        
$r $v1;
                        
$g $v;
                        
$b $v3;
                    }
                  
                    elseif(
$i == 3) {
                        
$r $v1;
                        
$g $v2;
                        
$b $v;
                    }
                  
                    elseif(
$i == 4) {
                        
$r $v3;
                        
$g $v1;
                        
$b $v;
                    }
                  
                    else {
                        
$r $v;
                        
$g $v1;
                        
$b $v2;
                    }
            
                    
$r $r 255;
                    
$g $g 255;
                    
$b $b 255;
                }
            
                return(array(
$r$g$b));
            }
            
            
// converts array($r, $g, $b) to "#HTML"
            
function array2html($clr) {
                return 
strtoupper("#" substr("00" dechex($clr[0]), -22) . substr("00" dechex($clr[1]), -22) . substr("00" dechex($clr[2]), -22));
            }

    
$v 0;


// Loop: assign color values to each value of $i
for ($row 1$row <= 10$row += 1) {


    
$hsv = array($h100$v);
    
$rgb hsv2rgb($hsv);
    
$hex array2html($rgb);
    
    echo(
'<table border=0 cellspacing=0>
            <td bgcolor='
.$hex.'>
            <p class="pattern">'
);
  
      for (
$col 1$col <= 10$col += 1) {
    
    
        if (
$x == "a") {
            echo( 
' ._ ');
        }
    
        if (
$x == "b") {
            echo(
' _... ');
        }      
        
        if (
$x == "c") {
            echo( 
' _._. ');
        }
    
        if (
$x == "d") {
            echo( 
' _.. ');
        }     
        
        if (
$x == "e") {
            echo( 
' . ');
        }
    
        if (
$x == "f") {
            echo( 
' .._. ');
        }      
        
        if (
$x == "g") {
            echo( 
' __. ');
        }
    
        if (
$x == "h") {
            echo( 
' .... ');
        }    
        
        if (
$x =="i") {
            echo( 
' .. ');
        }
    
        if (
$x == "j") {
            echo( 
' .___ ');
        }      
        
        if (
$x == "k") {
            echo( 
' _._ ');
        }
    
        if (
$x == "l") {
            echo( 
' ._.. ');
        }     
        
        if (
$x == "m") {
            echo( 
' __ ');
        }
    
        if (
$x == "n") {
            echo( 
' _. ');
        }      
        
        if (
$x == "o") {
            echo( 
' ___ ');
        }
        
        if (
$x == "p") {
            echo( 
' .__. ');
        }     
        
        if (
$x == "q") {
            echo( 
' __._ ');
        }     
    
        if (
$x == "r") {
            echo( 
' ._. ');
        }
    
        if (
$x == "s") {
            echo( 
' ... ');
        }      
        
        if (
$x == "t") {
            echo( 
' _ ');
        }
    
        if (
$x == "u") {
            echo( 
' .._ ');
        }     
        
        if (
$x == "v") {
            echo( 
' ..._ ');
        }
    
        if (
$x == "w") {
            echo( 
' .__ ');
        }      
        
        if (
$x == "x") {
            echo( 
' _.._ ');
        }
    
        if (
$x == "y") {
            echo( 
' _.__ ');
        }    
        
        if (
$x == "z") {
            echo( 
' __.. ');
            
            }
        
// echo($x);    
    
}
    
    
    
    
$v $v 10;
    echo(
"</p></td></table>");
    
}


    
?>
    </p>

    </body>
</html>
Last edited by: Lauren A Francescone
Edit access: Designer, Sysop