-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-icons.html
More file actions
107 lines (99 loc) · 2.66 KB
/
Copy pathgenerate-icons.html
File metadata and controls
107 lines (99 loc) · 2.66 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
<title>Generate Extension Icons</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
padding: 40px;
background: #1e1b4b;
color: white;
}
.icons {
display: flex;
gap: 20px;
margin: 20px 0;
}
.icon-box {
text-align: center;
}
canvas {
border: 2px solid #6366f1;
border-radius: 8px;
}
button {
margin-top: 10px;
padding: 8px 16px;
background: #6366f1;
border: none;
border-radius: 6px;
color: white;
cursor: pointer;
}
button:hover {
background: #4f46e5;
}
h1 { margin-bottom: 10px; }
p { color: #a5b4fc; margin-bottom: 20px; }
</style>
</head>
<body>
<h1>Extension Icon Generator</h1>
<p>Click the download buttons to save each icon, then place them in the <code>icons/</code> folder.</p>
<div class="icons">
<div class="icon-box">
<canvas id="icon16" width="16" height="16"></canvas>
<br>
<button onclick="download('icon16', 16)">Download 16x16</button>
</div>
<div class="icon-box">
<canvas id="icon48" width="48" height="48"></canvas>
<br>
<button onclick="download('icon48', 48)">Download 48x48</button>
</div>
<div class="icon-box">
<canvas id="icon128" width="128" height="128"></canvas>
<br>
<button onclick="download('icon128', 128)">Download 128x128</button>
</div>
</div>
<script>
const sizes = [16, 48, 128];
sizes.forEach(size => {
const canvas = document.getElementById(`icon${size}`);
const ctx = canvas.getContext('2d');
// Draw rounded rectangle background
const padding = size * 0.1;
const radius = size * 0.2;
ctx.fillStyle = '#6366f1';
ctx.beginPath();
ctx.roundRect(padding, padding, size - padding * 2, size - padding * 2, radius);
ctx.fill();
// Draw plus sign
const center = size / 2;
const lineLength = size * 0.4;
const lineWidth = Math.max(2, size * 0.12);
ctx.fillStyle = 'white';
ctx.fillRect(
center - lineWidth / 2,
center - lineLength / 2,
lineWidth,
lineLength
);
ctx.fillRect(
center - lineLength / 2,
center - lineWidth / 2,
lineLength,
lineWidth
);
});
function download(id, size) {
const canvas = document.getElementById(id);
const link = document.createElement('a');
link.download = `icon${size}.png`;
link.href = canvas.toDataURL('image/png');
link.click();
}
</script>
</body>
</html>