CSS滤镜灰度:我想要黑色 [英] CSS Filter grayscale: I want it Black
本文介绍了CSS滤镜灰度:我想要黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下css将我的彩色图片转换为灰度。
I am using the following css to convert my color images to grayscale.
img.desaturate{
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: url(desaturate.svg#greyscale);
filter: gray;
-webkit-filter: grayscale(1);
}
但我想要黑(rgb ,0,0)或#000000),而不是灰色。可能吗?
BUT I want it Black (rgb(0,0,0) or #000000), and not grey. Is it possible?
推荐答案
我想你只需要黑&白色的图像,像一个矢量图像或东西,是吗?
您可以尝试使用饱和亮度和对比度滤镜:
I supose you want only black & white images, like a vector image or something, that's it? You could try playing with the saturate brightness and contrast filters:
filter: gray saturate(0%) brightness(70%) contrast(1000%);
Demo in jsfiddle
(演示仅适用于Webkit,我太懒了写所有的供应商扩展:P)
Demo in jsfiddle (Demo only works in Webkit, I'm too lazy to write all vendor extensions :P)
这篇关于CSS滤镜灰度:我想要黑色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文