dijit/ColorPalette._Color (version 1.10)

dojo/_base/Color

Summary

Object associated with each cell in a ColorPalette palette. Implements dijit/Dye.

Usage

var foo = new ColorPalette._Color(alias,row,col,title);
dijit/ColorPalette
Parameter Type Description
alias String

English name of the color.

row Number

Vertical position in grid.

col undefined
title String

Localized name of the color.

Property Summary

Method Summary

  • _set(r,g,b,a)
  • fillCell(cell,blankGif)
  • getValue() Note that although dijit._Color is initialized with a value like "white" getValue() always returns a hex value
  • sanitize() makes sure that the object has correct attributes
  • setColor(color) Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value.
  • toCss(includeAlpha) Returns a css color string in rgb(a) representation
  • toHex() Returns a CSS color string in hexadecimal representation
  • toRgb() Returns 3 component array of rgb values
  • toRgba() Returns a 4 component array of rgba values from the color represented by this object.
  • toString() Returns a visual representation of the color

Properties

_imagePaths
Defined by: dijit/ColorPalette

This is stores the path to the palette images used for high-contrast mode display

a
Defined by: dojo/_base/Color
b
Defined by: dojo/_base/Color
g
Defined by: dojo/_base/Color
hcTemplate
Defined by: dijit/ColorPalette
r
Defined by: dojo/_base/Color
template
Defined by: dijit/ColorPalette

Methods

_set(r,g,b,a)
Defined by dojo/_base/Color
Parameter Type Description
r undefined
g undefined
b undefined
a undefined
fillCell(cell,blankGif)
Defined by dijit/ColorPalette
Parameter Type Description
cell DOMNode
blankGif String
getValue()
Defined by dijit/ColorPalette

Note that although dijit._Color is initialized with a value like "white" getValue() always returns a hex value

Returns:undefined
sanitize()
Defined by dojo/colors

makes sure that the object has correct attributes

setColor(color)
Defined by dojo/_base/Color

Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value.

Parameter Type Description
color Array | String | Object
Returns:function

Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value.

Examples

Example 1

require(["dojo/_base/color"], function(Color){
    var c = new Color(); // no color
    c.setColor("#ededed"); // greyish
});
toCss(includeAlpha)
Defined by dojo/_base/Color

Returns a css color string in rgb(a) representation

Parameter Type Description
includeAlpha Boolean
Optional
Returns:string

Examples

Example 1

require(["dojo/_base/color"], function(Color){
    var c = new Color("#FFF").toCss();
    console.log(c); // rgb('255','255','255')
});
toHex()
Defined by dojo/_base/Color

Returns a CSS color string in hexadecimal representation

Returns:string

Examples

Example 1

require(["dojo/_base/color"], function(Color){
    console.log(new Color([0,0,0]).toHex()); // #000000
});
toRgb()
Defined by dojo/_base/Color

Returns 3 component array of rgb values

Returns:Array

Examples

Example 1

require(["dojo/_base/color"], function(Color){
    var c = new Color("#000000");
    console.log(c.toRgb()); // [0,0,0]
});
toRgba()
Defined by dojo/_base/Color

Returns a 4 component array of rgba values from the color represented by this object.

Returns:Array
toString()
Defined by dojo/_base/Color

Returns a visual representation of the color

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