import cgitb;
cgitb.enable()
import cgi
form = cgi.FieldStorage()
print "Content-type: text/html"
print
print """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">"""
print form int(["red1"].value),"%"
print form int(["green1"].value),"%"
print form int(["blue1"].value),"%"
print form int(["red2"].value),"%"
print form int(["green2"].value),"%"
print form int(["blue2"].value),"%"
for i in range(nsteps):
        print i,
print """fraction = (i+1.0)/nsteps
r = (1-fraction)*red1 + fraction*red2
g = (1-fraction)*green1 + fraction*green2
b = (1-fraction)*blue1 + fraction*green2"""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Colour Blend</title>
<style type="text/css">
#blend {
        width: 10em;
        padding: 0;
        border: 1px solid black;
        margin-left: 3em
}
.colourblock {
        width: 10em;
        height: 1em;
}
</style>
</head>
<body>
<h1>Colour Blend</h1>
<p>Here is a mix of the two colours you specified:</p>
<div id="blend">
<div class="colourblock" style="background-colour: rgb(100.0%,10.0%,10.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,20.0%,20.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,30.0%,30.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,40.0%,40.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,50.0%,50.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,60.0%,60.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,70.0%,70.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,80.0%,80.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,90.0%,90.0%)">
</div>
<div class="colourblock" style="background-colour: rgb(100.0%,100.0%,100.0%)">
</div>
</div>
<hr class="footlink">Return to <a href="./>the index</a>.</p>
</body>
</html>