Docs Home

sb.widget.colorRandomizer

@File: /surebert/widget/colorRandomizer.js

@Author: Paul Visco 07-06-2008

@Description: Used to create a palette of random color swatches.


@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 = sb.events.target(e);
        
        document.body.style.backgroundColor = target.style.backgroundColor;
        
    }
});
y.palette.appendTo('#themes');

sb.widget.colorRandomizer.prototype.cycling

@File: /surebert/widget/colorRandomizer.js

@Description: Used to hold the reference to window.setInterval instance create by this.cycle();


@Example:

    window.clearInterval(yourInstance.cycler);
    

sb.widget.colorRandomizer.prototype.interval

@File: /surebert/widget/colorRandomizer.js

@Description: The amount of milliseconds between cycling the colors


@Example:

    

sb.widget.colorRandomizer.prototype.palette

@File: /surebert/widget/colorRandomizer.js

@Description: The sb.element node used to hold the palette. This is what you would append to to the DOM


@Example:

    yourInstance.palette.appendTo('#themes');
    

sb.widget.colorRandomizer.prototype.start

@File: /surebert/widget/colorRandomizer.js

@Description: Starts the cycling through the colors