Skip to main content
Pentaho Documentation

PaletteRegistry

pentaho.visual.color.PaletteRegistry

A singleton class that manages a set of discrete color palettes available for visuals to consume.

Standard Color Palettes

The registry comes pre-loaded with the following color palettes:

  1. "palette 1" (13 colors):

    #336699
    #99CCFF
    #999933
    #666699
    #CC9933
    #006666
    #3399FF
    #993300
    #CCCC99
    #666666
    #FFCC66
    #6699CC
    #663366
  2. "palette 2" (11 colors):

    #880A0F
    #B09A6B
    #772200
    #C52F0D
    #123D82
    #4A0866
    #FFAA00
    #1E8AD3
    #AA6611
    #8B2834
    #333333
  3. "palette 3" (12 colors):

    #387179
    #626638
    #A8979A
    #B09A6B
    #772200
    #C52F0D
    #123D82
    #4A0866
    #445500
    #FFAA00
    #1E8AD3
    #AA6611
  4. "ryg-3" (3 colors):

    #FF0000
    #FFFF00
    #008000
  5. "ryg-5" (5 colors):

    #FF0000
    #FFBF3F
    #FFFF00
    #BFDF3F
    #008000
  6. "ryb-3" (3 colors):

    #FF0000
    #FFFF00
    #4BB6E4
  7. "ryb-5" (5 colors):

    #FF0000
    #FFBF3F
    #FFFF00
    #DCDDDE
    #4BB6E4
  8. "blue-3" (3 colors):

    #CCDFED
    #6D85A4
    #0F2B5B
  9. "blue-5" (5 colors):

    #CCDFED
    #9CB2C8
    #6D85A4
    #3E587F
    #0F2B5B
  10. "gray-3" (3 colors):

    #E6E6E6
    #999999
    #333333
  11. "gray-5" (5 colors):

    #E6E6E6
    #CCCCCC
    #999999
    #666666
    #333333

AMD Module

require(["{pentaho.visual.color.PaletteRegistry} pentaho/visual/color/paletteRegistry"], function(PaletteRegistry) { /* code goes here */ });

Extends

Constructor

Name Description
new PaletteRegistry()

Creates the color palette registry singleton instance.

Members

Name Description
base : function
 
Protected

If a method has been overridden, then the base method provides access to the overridden method.

Methods

Name Description
add(palette) : pentaho.visual.color.PaletteRegistry

Adds a specified color palette.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

get(name) : pentaho.visual.color.IColorPalette

Gets a specified or default color palette.

getAll() : Array.<pentaho.visual.color.IColorPalette>

Gets an array with all registered color palettes.

setDefault(name) : pentaho.visual.color.PaletteRegistry

Sets the default color palette, given its name.

Constructor Details

new PaletteRegistry()

Creates the color palette registry singleton instance.

Source: javascript/web/pentaho/visual/color/paletteRegistry.js, line 25

Members Details

base: function
 
Protected

If a method has been overridden, then the base method provides access to the overridden method.

Can also be called from within a constructor function.

Source: javascript/web/pentaho/lang/Base.js, line 265

Inherited From: pentaho.lang.Base#base

Methods Details

add(palette) : pentaho.visual.color.PaletteRegistry

Adds a specified color palette.

Source: javascript/web/pentaho/visual/color/paletteRegistry.js, line 181

Parameters:
Name Default Value Summary
palette : pentaho.visual.color.IColorPalette

The color palette.

Returns:
Name Description
pentaho.visual.color.PaletteRegistry

This instance.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

Methods that are overridden are accessible through this.base.

This object is extended, but its class doesn't change.

Can be applied to non-Base instances (e.g. using Base.prototype.extend.call(alien, {a: "hello"})).

Source: javascript/web/pentaho/lang/Base.js, line 808

Inherited From: pentaho.lang.Base#extend

Parameters:
Name Default Value Summary
source : Object

The instance specification.

keyArgs : Object
 
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
exclude : Object
 
Optional

A map of property names to exclude from source.

Returns:
Name Description
Object

This object.

get(name) : pentaho.visual.color.IColorPalette

Gets a specified or default color palette.

When the name of the color palette is not specified, the default color palette is returned.

Source: javascript/web/pentaho/visual/color/paletteRegistry.js, line 247

Parameters:
Name Default Value Summary
name : String
 
Optional

The name of the desired color palette.

Returns:
Name Description
pentaho.visual.color.IColorPalette

The color palette.

getAll() : Array.<pentaho.visual.color.IColorPalette>

Gets an array with all registered color palettes.

Do not modify the returned array.

Source: javascript/web/pentaho/visual/color/paletteRegistry.js, line 203

Returns:
Name Description
Array.<pentaho.visual.color.IColorPalette>

An array of color palettes.

setDefault(name) : pentaho.visual.color.PaletteRegistry

Sets the default color palette, given its name.

If this method is not called, or if the name argument is not specified, the default palette becomes the first palette.

The default palette is obtained by calling pentaho.visual.color.PaletteRegistry#get with no arguments.

Source: javascript/web/pentaho/visual/color/paletteRegistry.js, line 228

Parameters:
Name Default Value Summary
name : String
 
Optional

The name of the default palette.

Returns:
Name Description
pentaho.visual.color.PaletteRegistry

This instance.

Example

Obtaining the default color palette.

var defaultPalette = paletteRegistry.get();