Poru
Poru

Reputation: 8360

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?)

Upvotes: 5

Views: 768

Answers (1)

Ned Batchelder
Ned Batchelder

Reputation: 375584

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)

Upvotes: 2

Related Questions