I have been searching for a method to convert my whole css stylesheet from color values to their respective grayscale values – however I couldn’t find a good way (aside from opening Photoshop and doing it the hard way).
Is there a method to do this, and does anybody know if there a jQuery script that could do it?
Note: This is not a question about converting color images to grayscale images, this is about converting a complete stylesheet to grayscale.
Here’s a Javascript function that will take RGB values, and return desaturated RGB values.
And if you wanted to desaturate a specific element in one foul swoop, you could do something like:
See this in action in this JSFiddle. Those desaturation multipliers come from this thread.
One other thing, the
kvalue is how much you want to desaturate by. 1 will desaturate completely, and 0 will not desaturate at all.