-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-icons.html
More file actions
195 lines (179 loc) · 6.05 KB
/
generate-icons.html
File metadata and controls
195 lines (179 loc) · 6.05 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Generate Extension Icons</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
text-align: center;
}
h1 {
color: #667eea;
}
.icons {
display: flex;
justify-content: center;
gap: 30px;
margin: 40px 0;
}
.icon-container {
text-align: center;
}
canvas {
border: 2px solid #ddd;
border-radius: 8px;
display: block;
margin: 10px auto;
}
button {
background: #667eea;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
margin: 5px;
}
button:hover {
background: #5568d3;
}
.instructions {
background: #f5f5f5;
padding: 20px;
border-radius: 8px;
text-align: left;
margin-top: 30px;
}
.instructions h3 {
margin-top: 0;
color: #667eea;
}
.instructions ol {
line-height: 1.8;
}
</style>
</head>
<body>
<h1>Dev Feedback Capture - Icon Generator</h1>
<p>Generate icon files for your Chrome extension</p>
<p>The repo already includes the generated PNGs. This page is handy if you want to refresh them.</p>
<div class="icons">
<div class="icon-container">
<h3>16x16</h3>
<canvas id="icon16" width="16" height="16"></canvas>
<button onclick="downloadIcon('icon16', 16)">Download</button>
</div>
<div class="icon-container">
<h3>48x48</h3>
<canvas id="icon48" width="48" height="48"></canvas>
<button onclick="downloadIcon('icon48', 48)">Download</button>
</div>
<div class="icon-container">
<h3>128x128</h3>
<canvas id="icon128" width="128" height="128"></canvas>
<button onclick="downloadIcon('icon128', 128)">Download</button>
</div>
</div>
<button onclick="downloadAllIcons()" style="background: #4CAF50; font-size: 16px; padding: 16px 32px;">
Download All Icons
</button>
<div class="instructions">
<h3>Instructions:</h3>
<ol>
<li>Click "Download All Icons" above (or download individually)</li>
<li>Save each icon with its correct filename:
<ul>
<li><code>icon16.png</code></li>
<li><code>icon48.png</code></li>
<li><code>icon128.png</code></li>
</ul>
</li>
<li>Place all three icon files in the <code>webDevFeedbackExt</code> folder</li>
<li>Reload the extension in Chrome</li>
</ol>
<p><strong>Note:</strong> If you prefer the terminal, you can also run <code>scripts/generate-icons.ps1</code> to regenerate all three files.</p>
</div>
<script>
// Draw icons on canvases
function drawIcon(canvasId, size) {
const canvas = document.getElementById(canvasId);
const ctx = canvas.getContext('2d');
// Background gradient
const gradient = ctx.createLinearGradient(0, 0, size, size);
gradient.addColorStop(0, '#667eea');
gradient.addColorStop(1, '#764ba2');
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, size, size);
// Draw feedback icon (speech bubble with cursor)
ctx.fillStyle = 'white';
// Scale everything based on size
const scale = size / 128;
// Speech bubble
const bubbleX = size * 0.25;
const bubbleY = size * 0.2;
const bubbleWidth = size * 0.55;
const bubbleHeight = size * 0.45;
const radius = size * 0.08;
// Draw rounded rectangle (speech bubble)
ctx.beginPath();
ctx.moveTo(bubbleX + radius, bubbleY);
ctx.lineTo(bubbleX + bubbleWidth - radius, bubbleY);
ctx.quadraticCurveTo(bubbleX + bubbleWidth, bubbleY, bubbleX + bubbleWidth, bubbleY + radius);
ctx.lineTo(bubbleX + bubbleWidth, bubbleY + bubbleHeight - radius);
ctx.quadraticCurveTo(bubbleX + bubbleWidth, bubbleY + bubbleHeight, bubbleX + bubbleWidth - radius, bubbleY + bubbleHeight);
// Tail of speech bubble
ctx.lineTo(bubbleX + bubbleWidth * 0.4, bubbleY + bubbleHeight);
ctx.lineTo(bubbleX + bubbleWidth * 0.3, bubbleY + bubbleHeight + size * 0.15);
ctx.lineTo(bubbleX + bubbleWidth * 0.3, bubbleY + bubbleHeight);
ctx.lineTo(bubbleX + radius, bubbleY + bubbleHeight);
ctx.quadraticCurveTo(bubbleX, bubbleY + bubbleHeight, bubbleX, bubbleY + bubbleHeight - radius);
ctx.lineTo(bubbleX, bubbleY + radius);
ctx.quadraticCurveTo(bubbleX, bubbleY, bubbleX + radius, bubbleY);
ctx.closePath();
ctx.fill();
// Add cursor icon in the bubble
if (size >= 48) {
ctx.fillStyle = '#667eea';
const cursorSize = size * 0.15;
const cursorX = bubbleX + bubbleWidth * 0.3;
const cursorY = bubbleY + bubbleHeight * 0.35;
// Draw cursor arrow
ctx.beginPath();
ctx.moveTo(cursorX, cursorY);
ctx.lineTo(cursorX, cursorY + cursorSize);
ctx.lineTo(cursorX + cursorSize * 0.4, cursorY + cursorSize * 0.7);
ctx.lineTo(cursorX + cursorSize * 0.6, cursorY + cursorSize);
ctx.lineTo(cursorX + cursorSize * 0.5, cursorY + cursorSize * 0.6);
ctx.lineTo(cursorX + cursorSize, cursorY + cursorSize * 0.5);
ctx.closePath();
ctx.fill();
}
}
// Download a single icon
function downloadIcon(canvasId, size) {
const canvas = document.getElementById(canvasId);
const link = document.createElement('a');
link.download = `icon${size}.png`;
link.href = canvas.toDataURL('image/png');
link.click();
}
// Download all icons
function downloadAllIcons() {
setTimeout(() => downloadIcon('icon16', 16), 0);
setTimeout(() => downloadIcon('icon48', 48), 200);
setTimeout(() => downloadIcon('icon128', 128), 400);
}
// Initialize
drawIcon('icon16', 16);
drawIcon('icon48', 48);
drawIcon('icon128', 128);
</script>
</body>
</html>