Core Docs | Additional Modules Docs

sb.widget.colorRandomizer


@Description: Used to create a palette of random color swatches.
@File: widget/colorRandomizer.js
@Author: Paul Visco 07-06-2008
@Param: Object An optional params argument who properties are applied to the instance you are creating
@Example:
var y = new sb.widget.colorRandomizer({
    numSwatches : 10,
    mouseDown : function(e, self){
        //do something when the swatch is clicked
        if(e.shiftKey){
            self.palette.remove();
            return;
        }
        var target = e.target;
        
        document.body.style.backgroundColor = target.style.backgroundColor;
        
    }
});
y.palette.appendTo('#themes');

sb.widget.colorRandomizer.prototype.cycling


@Description: Used to hold the reference to window.setInterval instance create by this.cycle();
@File: widget/colorRandomizer.js
@Example:
window.clearInterval(yourInstance.cycler);

sb.widget.colorRandomizer.prototype.interval


@Description: The amount of milliseconds between cycling the colors
@File: widget/colorRandomizer.js

sb.widget.colorRandomizer.prototype.palette


@Description: The sb.element node used to hold the palette. This is what you would append to to the DOM
@File: widget/colorRandomizer.js
@Example:
yourInstance.palette.appendTo('#themes');

sb.widget.colorRandomizer.prototype.start


@Description: Starts the cycling through the colors
@File: widget/colorRandomizer.js