Dark Mode Messenger - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dark Mode Messenger</title> <link href="https://fonts.googleapis.com/css2?family=Material+Icons" rel="stylesheet"> <style> body { margin: 0; font-family: Arial, sans-serif; background: #121212; display: flex; justify-content: center; align-items: center; height: 100vh; color: #f5f5f5; } .dark-messenger { width: 360px; height: 600px; background: #1e1e1e; border-radius: 15px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7); display: flex; flex-direction: column; overflow: hidden; } .header { background: #333; color: white; padding: 20px; display: flex; justify-content: space-between; align-items: center; } .header .material-icons { cursor: pointer; } .header .title { font-size: 20px; font-weight: bold; } .messages { flex: 1; padding: 20px; overflow-y: auto; background: #1e1e1e; } .message { margin-bottom: 20px; display: flex; align-items: flex-end; font-size: 14px; } .message.sent { justify-content: flex-end; } .message.received { justify-content: flex-start; } .message .content { max-width: 70%; padding: 10px 20px; border-radius: 15px; background: #333; position: relative; animation: fadeIn 0.3s ease-in-out; } .message.sent .content { background: #007bff; color: white; } .message .timestamp { font-size: 12px; color: #bbb; margin-left: 10px; } .message .avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; margin: 0 10px; } .message img { width: 100%; } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .input { display: flex; align-items: center; padding: 10px; background: #2c2c2c; } .input input { flex: 1; border: none; padding: 10px; border-radius: 20px; outline: none; margin: 0 10px; background: #3b3b3b; } .input .material-icons { cursor: pointer; color: #007bff; } .typing-indicator { display: none; font-size: 14px; color: #bbb; margin: 0 10px; } .typing-indicator.active { display: block; } </style> </head> <body> <div class="dark-messenger"> <div class="header"> <span class="material-icons">arrow_back</span> <div class="title">Dark Mode Messenger</div> <span class="material-icons">more_vert</span> </div> <div class="messages" id="messages"> <div class="message received"> <div class="avatar"><img src="https://via.placeholder.com/40" alt="Avatar"></div> <div class="content">Hey! How's everything? <span class="timestamp">10:45 AM</span></div> </div> <div class="message sent"> <div class="content">All good! What about you? <span class="timestamp">10:46 AM</span></div> <div class="avatar"><img src="https://via.placeholder.com/40" alt="Avatar"></div> </div> </div> <div class="input"> <span class="material-icons">insert_emoticon</span> <input type="text" id="message-input" placeholder="Type a message..."> <span class="material-icons" id="send-btn">send</span> </div> <div class="typing-indicator" id="typing-indicator">User is typing...</div> </div> <script> const input = document.getElementById('message-input'); const typingIndicator = document.getElementById('typing-indicator'); input.addEventListener('input', () => { if (input.value.length > 0) { typingIndicator.classList.add('active'); } else { typingIndicator.classList.remove('active'); } }); document.getElementById('send-btn').addEventListener('click', sendMessage); input.addEventListener('keypress', (e) => { if (e.key === 'Enter') { sendMessage(); } }); function sendMessage() { const messageText = input.value.trim(); if (messageText === '') return; const messages = document.getElementById('messages'); const message = document.createElement('div'); message.classList.add('message', 'sent'); const content = document.createElement('div'); content.classList.add('content'); content.innerHTML = `${messageText} <span class="timestamp">${new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</span>`; const avatar = document.createElement('div'); avatar.classList.add('avatar'); avatar.innerHTML = '<img src="https://via.placeholder.com/40" alt="Avatar">'; message.appendChild(content); message.appendChild(avatar); messages.appendChild(message); messages.scrollTop = messages.scrollHeight; input.value = ''; typingIndicator.classList.remove('active'); } </script> </body> </html>