All Rounder Tools Blogger-Best blog for blogger: HEX to Decimal converter Tool with colorful styling and all its features use any free library

Saturday, September 28, 2024

HEX to Decimal converter Tool with colorful styling and all its features use any free library

 

HEX to Decimal Converter

HEX to Decimal Converter

body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #f0f4f8, #a7c6ed); color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { text-align: center; background: white; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); } h1 { color: #4a90e2; margin-bottom: 20px; } input { padding: 10px; border: 2px solid #4a90e2; border-radius: 5px; width: 80%; max-width: 300px; margin-bottom: 20px; transition: border-color 0.3s; } input:focus { border-color: #0056b3; outline: none; } button { padding: 10px 15px; background-color: #4a90e2; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } button:hover { background-color: #0056b3; } .result { margin-top: 20px; font-size: 1.5em; color: #4caf50; } document.getElementById('convertBtn').addEventListener('click', function() { const hexInput = document.getElementById('hexInput').value; const resultDiv = document.getElementById('result'); // Remove the hash if it's present const hex = hexInput.replace('#', ''); // Validate hex input const isValidHex = /^[0-9A-Fa-f]{1,6}$/.test(hex); if (isValidHex) { const decimalValue = parseInt(hex, 16); resultDiv.textContent = `Decimal Value: ${decimalValue}`; } else { resultDiv.textContent = 'Please enter a valid HEX color code.'; } });

No comments:

Post a Comment