There are several ways to achieve this effect.
X: Utilizing CSS Blend Modes. A simple guide on CSS Tricks can be helpful in understanding them. To create a green color effect, you can implement:
.image-green {
background-image: url(image.jpg);
background-color: green;
background-blend-mode: multiply;
}
You can repeat the process for other desired colors. See an example here.
Y: If you prefer using filter
, then utilizing filter: hue-rotate
is essential. Specify a degree value like so:
.blue {
-webkit-filter: hue-rotate(180deg);
filter: hue-rotate(180deg);
}
View an example fiddle here.
Z: While more of an overlay technique, it proves effective with grayscale images. By adding a pseudo-element overlay and coloring it as desired using background-color
attribute! See an example here.
.img-wrapper {
position: relative;
}
.img-wrapper::after {
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(50, 200, 50, 0.4);
}