User:Joak/colorroute: Difference between revisions
No edit summary |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | python script for generating 1.677.216 html files with different backgroundcolors. Each html-file is linked with the java-script "window.location.href" to the next html-file - that means you will start with background-color #000000 and end with #ffffff! | ||
<pre> | |||
#!/usr/bin/env python | |||
for x in range(0, 16777216): | |||
name = hex(x).lstrip("0x") | |||
neext = hex(x+1).lstrip("0x") | |||
while len(name) < 6: | |||
name = "0" + name | |||
while len(neext) < 6: | |||
neext = "0" + neext | |||
file=open("tests/"+name+".html","w+") | |||
if x == 16777215: | |||
file.write("""<!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>the famous color route #"""+name+""""</title> | |||
<meta name="author" content="joak"> | |||
<script language="javascript" type="text/javascript"> | |||
window.setTimeout("window.location = '000000.html'",5000); | |||
</script> | |||
</head> | |||
<body bgcolor="#"""+name+""""> | |||
<div style="position:absolute;left:50%;top:50%;"><center><input type="button" onclick="window.location.href = '000000.html';" value="again"></center></div> | |||
</body> | |||
</html>""") | |||
else: | |||
file.write("""<!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>the famous color route #"""+name+""""</title> | |||
<meta name="author" content="joak"> | |||
<script language="javascript" type="text/javascript"> | |||
window.setTimeout("window.location = '"""+neext+""".html'",0); | |||
</script> | |||
</head> | |||
<body bgcolor="#"""+name+""""> | |||
</body> | |||
</html>""") | |||
file.close() | |||
print name | |||
</> | |||
</pre> | |||
screenshot as example(b-color #0000d7): | |||
[[File:Colorroute.png]] |
Latest revision as of 23:04, 8 July 2013
python script for generating 1.677.216 html files with different backgroundcolors. Each html-file is linked with the java-script "window.location.href" to the next html-file - that means you will start with background-color #000000 and end with #ffffff!
#!/usr/bin/env python for x in range(0, 16777216): name = hex(x).lstrip("0x") neext = hex(x+1).lstrip("0x") while len(name) < 6: name = "0" + name while len(neext) < 6: neext = "0" + neext file=open("tests/"+name+".html","w+") if x == 16777215: file.write("""<!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>the famous color route #"""+name+""""</title> <meta name="author" content="joak"> <script language="javascript" type="text/javascript"> window.setTimeout("window.location = '000000.html'",5000); </script> </head> <body bgcolor="#"""+name+""""> <div style="position:absolute;left:50%;top:50%;"><center><input type="button" onclick="window.location.href = '000000.html';" value="again"></center></div> </body> </html>""") else: file.write("""<!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>the famous color route #"""+name+""""</title> <meta name="author" content="joak"> <script language="javascript" type="text/javascript"> window.setTimeout("window.location = '"""+neext+""".html'",0); </script> </head> <body bgcolor="#"""+name+""""> </body> </html>""") file.close() print name </>