I have a PNG file and I would like to invert the black color of the objects to White on hover.
I already tried is this
img:hover {
-webkit-filter: grayscale(1) invert(1);
filter: grayscale(1) invert(1);
}
<img src="http://goproweb.ca/new/img/new/11.png">
This makes the objects grey, but I was hoping to make them to white.
Go to Edit > Edit Colors > Invert Colors.
An inverted PNG doesn't lose its sharpness, details, or color richness but it shows the image in a completely different way. You can see inverted photos in real life on old photographic films and photo negatives.
There are a few different ways that you can change a PNG from black to white in Photoshop. One way is to use the Levels tool. With the Levels tool, you can adjust the black point and the white point until the image is entirely white. Another way to change a PNG from black to white is to use the Selective Color tool.
I believe your issue is arising from using an image that is grey, rather than black. When this grey image is inverted, it just looks like a lighter color of grey.
Your code works fine, you just need to use a darker image to get the desired effect. Try swapping your image with this:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Yin_yang.svg/2000px-Yin_yang.svg.png" width="100px" height="100px">
Working fiddle with different image: https://jsfiddle.net/9f2cd2df/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With