forked from machineonamission/shitboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneratecollage.py
50 lines (45 loc) · 1 KB
/
generatecollage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from pathlib import Path
import random
folders = [r"shitboard\Library\Themes\shitboard.theme\IconBundles", r"settings icons"]
imgs = []
for folder in folders:
for icon in Path(folder).glob("*.png"):
imgs.append(f" <img src=\"{icon}\" alt=\"{icon.stem}\">")
random.shuffle(imgs)
imgs = "\n".join(imgs)
outfile = f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {{
padding: 0;
margin: 0;
}}
body {{
background: #555;
}}
.flex-container {{
display: flex;
flex-wrap: wrap;
}}
.flex-container > img {{
width: 60px;
margin: 10px;
border-radius: 21.67%;
}}
</style>
</head>
<body>
<div class="flex-container">
{imgs}
</div>
</body>
</html>
"""
with open("collagething.html", "w+") as f:
f.truncate(0)
f.seek(0)
f.write(outfile)