The ColorRange class is a simple utility that creates a range of colors to be used on elements of your choice. All you need is two colors and a selection of elements to apply a range of colors to and you're done.
ColorRange will work with MooTools 1.3 and 1.4 (without needing compatibility).
Default, a newly created ColorRange object simply defines the range you supplied and nothing else. It can be used to apply the range to an element selection or selector. There are multiply ways to accomplish this; the following examples will all yield the same result:
// create a color range and use it on the page's menu items var myRange = new ColorRange('#f00', [0, 0, 255]); myRange.apply($$('#menu li')); // apply a color range to the page's menu items $$('#menu li').applyColorRange('#f00', '#00f'); // call a utility function to color the page's menu items Color.applyRange('#f00', '#00f', '#menu li');
All the options of the ColorRange class are described below.
var myRange = new ColorRange(from, to);
Applies a color range to a property of all the passed elements. Returns the ColorRange instance.
myRange.apply(elements[, property]);
Utility to create a new color range from the Color class.
Color.range(from, to);
See Constructor.
Utility to apply a color range to a selection of elements.
Color.applyRange(from, to, elements[, property]);
Utility to apply a color range to an element collection.
$$('li.someClass').applyColorRange(from, to[, property]);
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus