JQuery: color fading

Is it possible to have 2 colors (red, green) and give a percentage of attenuation.

Example:

black (# 000000) => white (#ffffff) --- Percentage: 50% => gray (# 808080)

Is this possible with jQuery xcolor , if so, how?

(the xcolor.analogous example returns around the colors that I want to have, but how can I set the decay percentage?)

+5
source share
1 answer

It seems you almost answered your question: the xcolor plugin you are pointing to has exactly the method you want:

$.xcolor.gradientlevel(color, color, position, size)

Your example:

$.xcolor.gradientlevel("#000000", "#ffffff", 50, 100)
+2
source

All Articles