I know there are many css filters out there especially for webkit, but I can\'t find a solution for colorize a white (#FFFFFF) image. I\'ve tried some combination of the fil
i tried to color my white cloud picture following @zekkai's answer, and then i wrote a filter generator.
var slider_huerotate = document.getElementById("slider_huerotate");
var slider_brightness = document.getElementById("slider_brightness");
var slider_saturate = document.getElementById("slider_saturate");
var slider_sepia = document.getElementById("slider_sepia");
var output = document.getElementById("demo");
var cloud = document.getElementById('cloud');
let [brightness , sepia, saturate, huerotate] = ["100", "80", "100","360"];
var filtercolor = `brightness\(${brightness}%\) sepia\(${sepia}\) saturate\(${saturate}\) hue-rotate\(${huerotate}deg\)`
output.innerHTML = filtercolor; // Display the default slider value
// Update the current slider value (each time you drag the slider handle)
slider_huerotate.oninput = function() {
huerotate = this.value;
var filtercolor = `brightness\(${brightness}%\) sepia\(${sepia}\) saturate\(${saturate}\) hue-rotate\(${huerotate}deg\)`
cloud.style.filter = filtercolor;
output.innerHTML = filtercolor;
}
slider_brightness.oninput = function() {
brightness = this.value;
var filtercolor = `brightness\(${brightness}%\) sepia\(${sepia}\) saturate\(${saturate}\) hue-rotate\(${huerotate}deg\)`
cloud.style.filter = filtercolor;
output.innerHTML = filtercolor;
}
slider_sepia.oninput = function() {
sepia = this.value;
var filtercolor = `brightness\(${brightness}%\) sepia\(${sepia}\) saturate\(${saturate}\) hue-rotate\(${huerotate}deg\)`
cloud.style.filter = filtercolor;
output.innerHTML = filtercolor;
}
slider_saturate.oninput = function() {
saturate = this.value;
var filtercolor = `brightness\(${brightness}%\) sepia\(${sepia}\) saturate\(${saturate}\) hue-rotate\(${huerotate}deg\)`
cloud.style.filter = filtercolor;
output.innerHTML = filtercolor;
}
.slider {
-webkit-appearance: none;
width: 350px;
height: 15px;
border-radius: 5px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
img{
width:300px;
z-index:100;
filter: brightness(100%) sepia(80) saturate(100) hue-rotate(360deg);
padding:70px 25px 50px 25px;
}
.wrapper{
width:600px;
height:500px;
padding:50px;
font-size:small;
}
.slidecontainer_vertical{
margin-top: 50px;
transform: translate(0,300px) rotate(270deg);
-moz-transform: rotate(270deg);
}
.left{
width:50px;
height:300px;
float:left;
}
.cloud{
width:100%;
}
.middle{
width:350px;
height:300px;
float:left;
margin:0 auto;
}
.right{
width:50px;
height:300px;
float:left;
}
#demo{
width:100%;
text-align:center;
padding-bottom:20px;
font-family: 'Handlee', cursive;
}