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);
}
BUT I want it Black (rgb(0,0,0) or #000000), and not grey. Is it possible?
Simply paste your color (as a hex code) into the text input, then click "compute filters". This will convert your hex color into a css color, and compare it with the "real color". Then, just copy and paste the CSS code as needed.
0% will make the image completely black. 100% (1) is default, and represents the original image. Values over 100% will provide results with more contrast. Applies a drop shadow effect to the image.
Very easy when using the hue-rotate() filter. Make your images red, which has a hue value of 0, then use a hue chart to grab the colours you require for the hue rotation. Use the filter:grayscale(1) to set all images to grey, then on hover, set the grayscale to 0 and adjust the colour values. My pleasure.
Try using:
filter: brightness(0%);
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 (Demo only works in Webkit, I'm too lazy to write all vendor extensions :P)
I'm late to the party, but here's the best solution I found so far:
filter: brightness(0) invert(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