mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 06:04:54 +00:00
76 lines
1.9 KiB
HTML
76 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Generate PWA Icons</title>
|
|
</head>
|
|
<body>
|
|
<h1>PWA Icon Generator</h1>
|
|
<p>Run this in the browser console to generate icons</p>
|
|
<script>
|
|
function generateIcon(size) {
|
|
const canvas = document.createElement('canvas');
|
|
canvas.width = size;
|
|
canvas.height = size;
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
const gradient = ctx.createLinearGradient(0, 0, size, size);
|
|
gradient.addColorStop(0, '#7c3aed');
|
|
gradient.addColorStop(1, '#4facfe');
|
|
|
|
const cornerRadius = size * 0.25;
|
|
ctx.fillStyle = gradient;
|
|
ctx.beginPath();
|
|
ctx.roundRect(0, 0, size, size, cornerRadius);
|
|
ctx.fill();
|
|
|
|
ctx.strokeStyle = 'white';
|
|
ctx.lineWidth = size * 0.0625;
|
|
ctx.lineCap = 'round';
|
|
ctx.lineJoin = 'round';
|
|
|
|
const padding = size * 0.27;
|
|
const centerY = size / 2;
|
|
|
|
ctx.beginPath();
|
|
ctx.moveTo(padding, padding);
|
|
ctx.lineTo(padding, size - padding);
|
|
ctx.stroke();
|
|
|
|
ctx.beginPath();
|
|
ctx.moveTo(size - padding, padding);
|
|
ctx.lineTo(size - padding, size - padding);
|
|
ctx.stroke();
|
|
|
|
ctx.beginPath();
|
|
ctx.moveTo(padding, centerY);
|
|
ctx.lineTo(size - padding, centerY);
|
|
ctx.stroke();
|
|
|
|
const dotRadius = size * 0.03125;
|
|
ctx.fillStyle = 'white';
|
|
|
|
const dots = [
|
|
[padding, padding],
|
|
[size - padding, padding],
|
|
[padding, centerY],
|
|
[size / 2, centerY],
|
|
[size - padding, centerY],
|
|
[padding, size - padding],
|
|
[size - padding, size - padding],
|
|
];
|
|
|
|
dots.forEach(([x, y]) => {
|
|
ctx.beginPath();
|
|
ctx.arc(x, y, dotRadius, 0, Math.PI * 2);
|
|
ctx.fill();
|
|
});
|
|
|
|
return canvas.toDataURL('image/png');
|
|
}
|
|
|
|
console.log('Icon generators ready. Call generateIcon(size) to create an icon.');
|
|
</script>
|
|
</body>
|
|
</html>
|