Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: Color fade

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

Example:

black (#000000) => white (#ffffff) --- Percent: 50% => grey (#808080)

Is this maybe possible with jQuery xcolor, if yes, how?

(the xcolor.analogous example return circa the colors I want to have, but how could I set the percentage of fading?)

like image 298
Poru Avatar asked Nov 05 '22 07:11

Poru


1 Answers

You seem to have almost answered your own question: The xcolor plugin you point to has exactly the method you want:

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

Your example would be:

$.xcolor.gradientlevel("#000000", "#ffffff", 50, 100)
like image 146
Ned Batchelder Avatar answered Nov 12 '22 15:11

Ned Batchelder