User:Joak/colorroute: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 44: Line 44:
print name
print name
</>
</>
screenshot as example:

Revision as of 23:56, 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!

<source lang="javascript">

  1. !/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+"""">

<input type="button" onclick="window.location.href = '000000.html';" value="again">

</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 </>

screenshot as example: