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

Sunday, September 29, 2024

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

 

HEX to Octal Converter

HEX to Octal Converter

Octal Value:

body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #f3ec78, #af4261); color: white; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; } .container { background-color: rgba(0, 0, 0, 0.7); padding: 20px; border-radius: 8px; text-align: center; box-shadow: 0 0 15px rgba(0, 0, 0, 0.5); } h1 { margin-bottom: 20px; } .input-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; } input { padding: 10px; border: none; border-radius: 5px; width: 100%; font-size: 16px; } button { padding: 10px 15px; background-color: #6c63ff; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #5a54d5; } .result { margin-top: 20px; } h2 { margin-bottom: 10px; } p { font-size: 18px; font-weight: bold; } document.getElementById('convertButton').addEventListener('click', function() { const hexInput = document.getElementById('hexInput').value.trim(); const resultOutput = document.getElementById('resultOutput'); // Validate hex input if (!/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(hexInput)) { resultOutput.textContent = 'Please enter a valid HEX color code!'; return; } // Remove hash symbol if present const hexValue = hexInput.replace('#', ''); // Convert HEX to decimal const decimalValue = parseInt(hexValue, 16); // Convert decimal to octal const octalValue = decimalValue.toString(8); resultOutput.textContent = octalValue.toUpperCase(); });

No comments:

Post a Comment