aoc2021/d09/tohtml.py

19 lines
519 B
Python
Raw Normal View History

2021-12-09 22:55:58 +00:00
C = ['#16ff00','#72ed00','#9adb00','#b7c700','#cdb200','#e09b00','#ee8200','#f86600','#fe4400','#ff0000',]
print("""<html>
<head>
<style>
span { color:white }""")
for (i,c) in enumerate(C):
print(".c%d { background-color:%s }"%(i,c))
print("""</style>
</head>
<body>""")
import sys
for l in sys.stdin.read().splitlines():
for c in l:
#print('<span class="c%s">&nbsp;&nbsp;&nbsp;&nbsp;</span>'%(c), end='')
print('<span class="c%s">&nbsp;%s&nbsp;</span>'%(c,c), end='')
print('<br>')
print("""</body>
</html>""")