dojox/color/Palette (version 1.10)

Summary

An object that represents a palette of colors.

A Palette is a representation of a set of colors. While the standard number of colors contained in a palette is 5, it can really handle any number of colors.

A palette is useful for the ability to transform all the colors in it using a simple object-based approach. In addition, you can generate palettes using dojox.color.Palette.generate; these generated palettes are based on the palette generators at http://kuler.adobe.com.

Usage

Palette(base);
Parameter Type Description
base String | Array | dojox.color.Color | dojox.color.Palette

See the dojox/color/Palette reference documentation for more information.

Property Summary

Method Summary

  • clone() Clones the current palette.
  • generate(base,type) Generate a new Palette using any of the named functions in dojox.color.Palette.generators or an optional function definition.
  • transform(kwArgs) Transform the palette using a specific transformation function and a set of transformation parameters.

Properties

generators
Defined by: dojox/color/Palette

Methods

clone()
Defined by dojox/color/Palette

Clones the current palette.

Returns:instance
generate(base,type)
Defined by dojox/color/Palette

Generate a new Palette using any of the named functions in dojox.color.Palette.generators or an optional function definition. Current generators include "analogous", "monochromatic", "triadic", "complementary", "splitComplementary", and "shades".

Parameter Type Description
base String | dojox.color.Color
type Function | String
Returns:undefined
transform(kwArgs)
Defined by dojox/color/Palette

Transform the palette using a specific transformation function and a set of transformation parameters.

{palette}.transform is a simple way to uniformly transform all of the colors in a palette using any of 5 formulae: RGBA, HSL, HSV, CMYK or CMY.

Once the forumula to be used is determined, you can pass any number of parameters based on the formula "d"[param]; for instance, { use: "rgba", dr: 20, dg: -50 } will take all of the colors in palette, add 20 to the R value and subtract 50 from the G value.

Unlike other types of transformations, transform does not alter the original palette but will instead return a new one.

Parameter Type Description
kwArgs Object

An object with the following properties:

  • use (String, optional):

    Specify the color model to use for the transformation. Can be "rgb", "rgba", "hsv", "hsl", "cmy", "cmyk".

  • dr (Number, optional):

    The delta to be applied to the red aspect of the RGB/RGBA color model.

  • dg (Number, optional):

    The delta to be applied to the green aspect of the RGB/RGBA color model.

  • db (Number, optional):

    The delta to be applied to the blue aspect of the RGB/RGBA color model.

  • da (Number, optional):

    The delta to be applied to the alpha aspect of the RGBA color model.

  • dc (Number, optional):

    The delta to be applied to the cyan aspect of the CMY/CMYK color model.

  • dm (Number, optional):

    The delta to be applied to the magenta aspect of the CMY/CMYK color model.

  • dy (Number, optional):

    The delta to be applied to the yellow aspect of the CMY/CMYK color model.

  • dk (Number, optional):

    The delta to be applied to the black aspect of the CMYK color model.

  • dh (Number, optional):

    The delta to be applied to the hue aspect of the HSL/HSV color model.

  • ds (Number, optional):

    The delta to be applied to the saturation aspect of the HSL/HSV color model.

  • dl (Number, optional):

    The delta to be applied to the luminosity aspect of the HSL color model.

  • dv (Number, optional):

    The delta to be applied to the value aspect of the HSV color model.

Returns:undefined
Error in the documentation? Can’t find what you are looking for? Let us know!