CSS3 grayscale filter looks different on different

2019-07-25 17:14发布

I have 3 icons of FCB, twitter and RSS and I want them to be grayscale but on hover they should change to color version. It is working great but these 3 images looks a bit different in grayscale. Is there a way to make them looks the same? This is my code for grayscale:

img.grayscale{
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
    filter: gray;
    -webkit-filter: grayscale(1);
}

RSS and twitter looks almost the same but FCB icon is a lot darker. I think that the only way is to play with grayscale percentage. Is there any other solution?

1条回答
别忘想泡老子
2楼-- · 2019-07-25 17:38

You can add a class of fb on the fb image and set

img.fb {
     opacity: 0.7;   
}

This will give the illusion of making the image more light.

Here is the jsfiddle

查看更多
登录 后发表回答