RGB to HEX Converter Color Picker
RGB to HEX Converter Color Picker
RGB to HEX Converter with Color Picker
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
}
h1 {
text-align: center;
margin-top: 20px;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
margin-top: 50px;
}
.color-picker {
display: flex;
flex-direction: column;
align-items: center;
margin-right: 50px;
}
.color-picker label {
margin-bottom: 10px;
}
.color-box {
display: flex;
flex-direction: column;
align-items: center;
}
#color {
width: 150px;
height: 150px;
margin-bottom: 10px;
border: 2px solid #333;
}
#hex {
font-size: 24px;
font-weight: bold;
}
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
}
h1 {
text-align: center;
margin-top: 20px;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
margin-top: 50px;
}
.color-picker {
display: flex;
flex-direction: column;
align-items: center;
margin-right: 50px;
}
.color-picker label {
margin-bottom: 10px;
}
.color-box {
display: flex;
flex-direction: column;
align-items: center;
}
#color {
width: 150px;
height: 150px;
margin-bottom: 10px;
border: 2px solid #333;
}
#hex {
font-size: 24px;
font-weight: bold;
}
function updateColor() {
var red = document.getElementById("red").value;
var green = document.getElementById("green").value;
var blue = document.getElementById("blue").value;
var color = "rgb(" + red + "," + green + "," + blue + ")";
var hex = rgbToHex(red, green, blue);
document.getElementById("color").style.backgroundColor = color;
document.getElementById("hex").innerHTML = hex;
}
function rgbToHex(red, green, blue) {
var redHex = Number(red).toString(16).padStart(2, '0');
var greenHex = Number(green).toString(16).padStart(2, '0');
var blueHex = Number(blue).toString(16).padStart(2, '0');
var hex = "#" + redHex + greenHex + blueHex;
return hex;
}
https://www.highrevenuegate.com/fymqjazgx?key=fc3734f48fe9a9866742eb9027197659
Comments
Post a Comment