MapShape.getRGBColor

Syntax

getRGBColor();

Description

The getRGBColor method returns color of map layer area as an array of shares of red, green and blue colors.

Comments

The method returns an array of the Number type values.

Example

To execute the example the HTML page must contain the MapChart component named map and the ToolBar component named MapType (see  Example of Creating the MapChart Component). Determine color of the map layer area with the RU identifier:

// Get a map layer area with the RU ID
var shape = map.getShape("RU");
// Determine area color
var rgb = shape.getRGBColor();
console.log("Red color share: " + rgb[0]);
console.log("Green color share: " + rgb[1]);
console.log("Blue color share: " + rgb[2]);

After executing the example, the browser console displays colors of the map layer area with the RU identifier as shares of red, green and blue color:

Red color share: 0.8156862745098039

Green color share: 0.4

Blue color share: 0.39215686274509803

See also:

MapShape