File size: 14,689 Bytes
7b6b1e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>QRGen | Text to QR Code Generator</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/build/qrcode.min.js"></script>
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .qr-container {
            transition: all 0.3s ease;
        }
        .qr-container:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .download-btn {
            transition: all 0.3s ease;
        }
        .download-btn:hover {
            transform: scale(1.05);
        }
        .glow {
            box-shadow: 0 0 15px rgba(167, 119, 227, 0.5);
        }
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        .pulse {
            animation: pulse 2s infinite;
        }
    </style>
</head>
<body class="min-h-screen bg-gray-50">
    <header class="gradient-bg text-white shadow-lg">
        <div class="container mx-auto px-4 py-6">
            <div class="flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <i class="fas fa-qrcode text-3xl"></i>
                    <h1 class="text-2xl font-bold">QRGen</h1>
                </div>
                <nav>
                    <ul class="flex space-x-6">
                        <li><a href="#" class="hover:underline">Home</a></li>
                        <li><a href="#" class="hover:underline">Features</a></li>
                        <li><a href="#" class="hover:underline">About</a></li>
                    </ul>
                </nav>
            </div>
        </div>
    </header>

    <main class="container mx-auto px-4 py-12">
        <section class="text-center mb-16">
            <h2 class="text-4xl font-bold text-gray-800 mb-4">Text to QR Code Generator</h2>
            <p class="text-xl text-gray-600 max-w-2xl mx-auto">Convert any text or URL into a QR code instantly. Free, fast, and easy to use!</p>
        </section>

        <section class="flex flex-col lg:flex-row gap-8 items-center justify-center">
            <div class="w-full lg:w-1/2 bg-white rounded-xl shadow-lg p-8 qr-container">
                <div class="mb-6">
                    <label for="qr-text" class="block text-gray-700 font-medium mb-2">Enter Text or URL</label>
                    <div class="relative">
                        <textarea id="qr-text" rows="4" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent" placeholder="Type your text or URL here..."></textarea>
                        <div class="absolute right-3 bottom-3 flex space-x-2">
                            <button id="clear-btn" class="text-gray-500 hover:text-gray-700">
                                <i class="fas fa-trash-alt"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="mb-6">
                    <label class="block text-gray-700 font-medium mb-2">QR Code Options</label>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div>
                            <label for="qr-size" class="block text-sm text-gray-600 mb-1">Size (px)</label>
                            <select id="qr-size" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent">
                                <option value="100">100x100</option>
                                <option value="150">150x150</option>
                                <option value="200" selected>200x200</option>
                                <option value="250">250x250</option>
                                <option value="300">300x300</option>
                            </select>
                        </div>
                        <div>
                            <label for="qr-color" class="block text-sm text-gray-600 mb-1">Color</label>
                            <input type="color" id="qr-color" value="#000000" class="w-full h-10 border border-gray-300 rounded-lg cursor-pointer">
                        </div>
                    </div>
                </div>

                <button id="generate-btn" class="w-full gradient-bg text-white font-bold py-3 px-4 rounded-lg hover:opacity-90 transition duration-300 flex items-center justify-center space-x-2">
                    <i class="fas fa-qrcode"></i>
                    <span>Generate QR Code</span>
                </button>
            </div>

            <div class="w-full lg:w-1/2 bg-white rounded-xl shadow-lg p-8 qr-container flex flex-col items-center">
                <div id="qr-result" class="mb-6 p-4 border-2 border-dashed border-gray-200 rounded-lg flex items-center justify-center">
                    <p class="text-gray-500">Your QR code will appear here</p>
                </div>
                
                <div id="download-section" class="hidden w-full">
                    <div class="flex flex-col sm:flex-row gap-4 justify-center">
                        <button id="download-png" class="download-btn bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg flex items-center space-x-2">
                            <i class="fas fa-download"></i>
                            <span>PNG</span>
                        </button>
                        <button id="download-svg" class="download-btn bg-green-500 hover:bg-green-600 text-white font-medium py-2 px-4 rounded-lg flex items-center space-x-2">
                            <i class="fas fa-download"></i>
                            <span>SVG</span>
                        </button>
                        <button id="download-jpg" class="download-btn bg-purple-500 hover:bg-purple-600 text-white font-medium py-2 px-4 rounded-lg flex items-center space-x-2">
                            <i class="fas fa-download"></i>
                            <span>JPG</span>
                        </button>
                    </div>
                </div>
            </div>
        </section>

        <section class="mt-20">
            <h3 class="text-2xl font-bold text-center text-gray-800 mb-8">How It Works</h3>
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <div class="text-purple-500 text-4xl mb-4">
                        <i class="fas fa-keyboard"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-2">1. Enter Your Text</h4>
                    <p class="text-gray-600">Type or paste any text, URL, or contact information you want to encode into a QR code.</p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <div class="text-purple-500 text-4xl mb-4">
                        <i class="fas fa-sliders-h"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-2">2. Customize Options</h4>
                    <p class="text-gray-600">Adjust the size and color of your QR code to match your preferences or branding.</p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md hover:shadow-lg transition duration-300">
                    <div class="text-purple-500 text-4xl mb-4">
                        <i class="fas fa-qrcode pulse"></i>
                    </div>
                    <h4 class="text-xl font-semibold mb-2">3. Generate & Download</h4>
                    <p class="text-gray-600">Create your QR code instantly and download it in PNG, SVG, or JPG format.</p>
                </div>
            </div>
        </section>
    </main>

    <footer class="gradient-bg text-white py-8">
        <div class="container mx-auto px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">QRGen</h3>
                    <p class="text-purple-100">The easiest way to create QR codes</p>
                </div>
                <div class="flex space-x-6">
                    <a href="#" class="hover:text-purple-200"><i class="fab fa-twitter text-xl"></i></a>
                    <a href="#" class="hover:text-purple-200"><i class="fab fa-github text-xl"></i></a>
                    <a href="#" class="hover:text-purple-200"><i class="fab fa-linkedin text-xl"></i></a>
                </div>
            </div>
            <div class="border-t border-purple-300 mt-6 pt-6 text-center text-purple-100">
                <p>&copy; 2023 QRGen. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const qrText = document.getElementById('qr-text');
            const qrResult = document.getElementById('qr-result');
            const generateBtn = document.getElementById('generate-btn');
            const clearBtn = document.getElementById('clear-btn');
            const qrSize = document.getElementById('qr-size');
            const qrColor = document.getElementById('qr-color');
            const downloadPng = document.getElementById('download-png');
            const downloadSvg = document.getElementById('download-svg');
            const downloadJpg = document.getElementById('download-jpg');
            const downloadSection = document.getElementById('download-section');
            
            let currentQRCode = null;

            // Generate QR code
            generateBtn.addEventListener('click', function() {
                const text = qrText.value.trim();
                const size = parseInt(qrSize.value);
                const color = qrColor.value;
                
                if (!text) {
                    alert('Please enter some text or URL to generate QR code');
                    return;
                }
                
                qrResult.innerHTML = '';
                
                QRCode.toCanvas(text, {
                    width: size,
                    color: {
                        dark: color,
                        light: '#ffffff'
                    },
                    margin: 2
                }, function(err, canvas) {
                    if (err) {
                        console.error(err);
                        qrResult.innerHTML = '<p class="text-red-500">Error generating QR code</p>';
                        return;
                    }
                    
                    currentQRCode = canvas;
                    qrResult.appendChild(canvas);
                    downloadSection.classList.remove('hidden');
                    
                    // Add glow effect
                    canvas.classList.add('glow');
                    setTimeout(() => {
                        canvas.classList.remove('glow');
                    }, 2000);
                });
            });
            
            // Clear input
            clearBtn.addEventListener('click', function() {
                qrText.value = '';
            });
            
            // Download PNG
            downloadPng.addEventListener('click', function() {
                if (!currentQRCode) return;
                
                const link = document.createElement('a');
                link.download = 'qr-code.png';
                link.href = currentQRCode.toDataURL('image/png');
                link.click();
            });
            
            // Download SVG
            downloadSvg.addEventListener('click', function() {
                const text = qrText.value.trim();
                if (!text) return;
                
                QRCode.toString(text, {
                    type: 'svg',
                    color: {
                        dark: qrColor.value,
                        light: '#ffffff'
                    },
                    margin: 2
                }, function(err, svg) {
                    if (err) {
                        console.error(err);
                        return;
                    }
                    
                    const blob = new Blob([svg], {type: 'image/svg+xml'});
                    const url = URL.createObjectURL(blob);
                    const link = document.createElement('a');
                    link.download = 'qr-code.svg';
                    link.href = url;
                    link.click();
                    URL.revokeObjectURL(url);
                });
            });
            
            // Download JPG
            downloadJpg.addEventListener('click', function() {
                if (!currentQRCode) return;
                
                const link = document.createElement('a');
                link.download = 'qr-code.jpg';
                link.href = currentQRCode.toDataURL('image/jpeg', 0.9);
                link.click();
            });
            
            // Example QR code on page load
            QRCode.toCanvas('https://example.com', {
                width: 150,
                margin: 2
            }, function(err, canvas) {
                if (err) return;
                qrResult.innerHTML = '';
                qrResult.appendChild(canvas);
                qrText.value = 'https://example.com';
            });
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=shubham6924/text-to-qr" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>