-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_icons.html
More file actions
229 lines (194 loc) · 5.74 KB
/
create_icons.html
File metadata and controls
229 lines (194 loc) · 5.74 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Generate Feedly Saved Opener Icons</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 40px;
background: #f0f0f0;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
margin-bottom: 20px;
}
.icon-preview {
display: flex;
gap: 20px;
margin: 20px 0;
flex-wrap: wrap;
}
.icon-item {
text-align: center;
}
canvas {
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
margin: 5px;
}
button:hover {
opacity: 0.9;
}
.instructions {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
margin-top: 20px;
border-left: 4px solid #667eea;
}
.instructions ol {
margin-left: 20px;
}
.instructions li {
margin: 10px 0;
}
</style>
</head>
<body>
<div class="container">
<h1>⭐ Feedly Saved Opener Icon Generator</h1>
<p>Generate production-ready icons for the Firefox extension</p>
<div class="icon-preview">
<div class="icon-item">
<h3>48x48</h3>
<canvas id="icon48" width="48" height="48"></canvas>
<br>
<button onclick="downloadIcon('icon48', 'icon-48.png')">Download 48x48</button>
</div>
<div class="icon-item">
<h3>96x96</h3>
<canvas id="icon96" width="96" height="96"></canvas>
<br>
<button onclick="downloadIcon('icon96', 'icon-96.png')">Download 96x96</button>
</div>
</div>
<button onclick="downloadAll()" style="margin-top: 20px; width: 100%;">
📦 Download All Icons
</button>
<div class="instructions">
<h3>📋 Installation Instructions:</h3>
<ol>
<li>Click "Download All Icons" or download each icon individually</li>
<li>Create an <code>icons/</code> folder in your extension directory</li>
<li>Save both icons to the <code>icons/</code> folder</li>
<li>Reload the extension in Firefox</li>
</ol>
</div>
</div>
<script>
function drawStar(ctx, cx, cy, spikes, outerRadius, innerRadius) {
let rot = Math.PI / 2 * 3;
let x = cx;
let y = cy;
const step = Math.PI / spikes;
ctx.beginPath();
ctx.moveTo(cx, cy - outerRadius);
for (let i = 0; i < spikes; i++) {
x = cx + Math.cos(rot) * outerRadius;
y = cy + Math.sin(rot) * outerRadius;
ctx.lineTo(x, y);
rot += step;
x = cx + Math.cos(rot) * innerRadius;
y = cy + Math.sin(rot) * innerRadius;
ctx.lineTo(x, y);
rot += step;
}
ctx.lineTo(cx, cy - outerRadius);
ctx.closePath();
}
function createIcon(canvasId, size) {
const canvas = document.getElementById(canvasId);
const ctx = canvas.getContext('2d');
// Clear canvas
ctx.clearRect(0, 0, size, size);
// Create gradient background
const gradient = ctx.createLinearGradient(0, 0, size, size);
gradient.addColorStop(0, '#667eea');
gradient.addColorStop(1, '#764ba2');
// Draw rounded rectangle background
const radius = size * 0.15;
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.moveTo(radius, 0);
ctx.lineTo(size - radius, 0);
ctx.quadraticCurveTo(size, 0, size, radius);
ctx.lineTo(size, size - radius);
ctx.quadraticCurveTo(size, size, size - radius, size);
ctx.lineTo(radius, size);
ctx.quadraticCurveTo(0, size, 0, size - radius);
ctx.lineTo(0, radius);
ctx.quadraticCurveTo(0, 0, radius, 0);
ctx.closePath();
ctx.fill();
// Draw star
const center = size / 2;
const starSize = size * 0.5;
const outerRadius = starSize / 2;
const innerRadius = outerRadius * 0.4;
ctx.fillStyle = '#ffffff';
ctx.strokeStyle = '#ffffff';
ctx.lineWidth = size * 0.04;
ctx.shadowColor = 'rgba(0, 0, 0, 0.3)';
ctx.shadowBlur = size * 0.1;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = size * 0.05;
drawStar(ctx, center, center, 5, outerRadius, innerRadius);
ctx.fill();
ctx.stroke();
// Reset shadow
ctx.shadowColor = 'transparent';
ctx.shadowBlur = 0;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
// Add highlight to star
const highlightGradient = ctx.createLinearGradient(
center - outerRadius, center - outerRadius,
center + outerRadius, center + outerRadius
);
highlightGradient.addColorStop(0, 'rgba(255, 255, 255, 0.3)');
highlightGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
ctx.fillStyle = highlightGradient;
drawStar(ctx, center, center, 5, outerRadius, innerRadius);
ctx.fill();
}
function downloadIcon(canvasId, filename) {
const canvas = document.getElementById(canvasId);
const link = document.createElement('a');
link.download = filename;
link.href = canvas.toDataURL('image/png');
link.click();
}
function downloadAll() {
downloadIcon('icon48', 'icon-48.png');
setTimeout(() => {
downloadIcon('icon96', 'icon-96.png');
}, 100);
}
// Generate icons on page load
window.onload = () => {
createIcon('icon48', 48);
createIcon('icon96', 96);
};
</script>
</body>
</html>