You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.5 KiB
Python

10 months ago
import os
for x in range(0, 256):
namex = hex(x).lstrip("0x")
nextx = hex(x+1).lstrip("0x")
while len(namex) < 2:
namex = "0" + namex
while len(nextx) < 2:
nextx = "0" + nextx
if x is 255:
nextx = "00"
if not os.path.exists(namex):
os.makedirs(namex)
for y in range(0, 256):
namey = hex(y).lstrip("0x")
nexty = hex(y+1).lstrip("0x")
while len(namey) < 2:
namey = "0" + namey
while len(nexty) < 2:
nexty = "0" + nexty
if y is 255:
nexty = "00"
if not os.path.exists(namex+"/"+namey):
os.makedirs(namex+"/"+namey)
for z in range(0, 256):
namez = hex(z).lstrip("0x")
nextz = hex(z+1).lstrip("0x")
while len(namez) < 2:
namez = "0" + namez
while len(nextz) < 2:
nextz = "0" + nextz
if z is 255:
nextz = "00"
color = namex + namey + namez
file=open(namex+"/"+namey+"/"+namez+".html","w+")
if x is 255 and y is 255 and z is 255:
file.write("""<!DOCTYPE html>
<meta name="description" content="A route trough all html colors"/>
<meta name="author" content="joak">
<meta http-equiv="refresh" content="5; url=../../00/00/00.html">
<head>
<title>the famous color route #"""+color+"""</title>
</head>
<body bgcolor="#"""+color+"""">
<div style="position:absolute;left:50%;top:50%;"><center><input type="button" onclick="window.location.href = '000000.html';" value="again"></center></div>
</body>
</html>""")
elif y is 255 and z is 255:
file.write("""<!DOCTYPE html>
<meta name="description" content="A route trough all html colors"/>
<meta name="author" content="joak">
<meta http-equiv="refresh" content="0.1; url=../../"""+nextx+"""/"""+nexty+"""/"""+nextz+""".html">
<head>
<title>the famous color route #"""+color+"""</title>
</head>
<body bgcolor="#"""+color+"""">
</body>
</html>""")
elif z is 255:
file.write("""<!DOCTYPE html>
<meta name="author" content="joak">
<meta name="description" content="A route trough all html colors"/>
<meta http-equiv="refresh" content="0.1; url=../../"""+namex+"""/"""+nexty+"""/"""+nextz+""".html">
<head>
<title>the famous color route #"""+color+"""</title>
</head>
<body bgcolor="#"""+color+"""">
</body>
</html>""")
else:
file.write("""<!DOCTYPE html>
<meta name="author" content="joak">
<meta name="description" content="A route trough all html colors"/>
<meta http-equiv="refresh" content="0.1; url=../../"""+namex+"""/"""+namey+"""/"""+nextz+""".html">
<head>
<title>the famous color route #"""+color+"""</title>
</head>
<body bgcolor="#"""+color+"""">
</body>
</html>""")
file.close()
print (namex+" "+namey+" "+namez)