Class: Color

Color

new Color(red, green, blue, alpha)

A color specified using red, green, blue, and transparency values, ranging from 0 (no intensity) to 1.0 (full intensity).

Name Type Default Description
red Number 1.0 optional

The red part.

green Number 1.0 optional

The green part.

blue Number 1.0 optional

The blue part.

alpha Number 1.0 optional

Transparency section.

See:
  • Packable

Members

(static, constant) ALICEBLUEColor

Initialize an immutable Color instance as CSS color # F0F8FF.

(static, constant) ANTIQUEWHITEColor

Initialize an immutable Color instance as CSS color # FAEBD7.

(static, constant) AQUAColor

Initialize an immutable Color instance as CSS color # 00FFFF.

(static, constant) AQUAMARINEColor

Initialize an immutable Color instance as CSS color # 7FFFFD4.

(static, constant) AZUREColor

Initialize an immutable Color instance as CSS color # F0FFFF.

(static, constant) BEIGEColor

Initialize an immutable Color instance as CSS color # F5F5DC.

(static, constant) BISQUEColor

Initialize an immutable Color instance as CSS color # FFE4C4.

(static, constant) BLACKColor

Initialize an immutable Color instance as CSS color # 000000.

(static, constant) BLANCHEDALMONDColor

Initialize an immutable Color instance as CSS color # FFEBCD.

(static, constant) BLUEColor

Initialize an immutable Color instance as CSS color # 0000FF.

(static, constant) BLUEVIOLETColor

Initialize an immutable Color instance as CSS color # 8A2BE2.

(static, constant) BROWNColor

Initialize an immutable Color instance as CSS color # A52A2A.

(static, constant) BURLYWOODColor

Initialize an immutable Color instance as CSS color # DEB887.

(static, constant) CADETBLUEColor

Initialize an immutable Color instance as CSS color # 5F9EA0.

(static, constant) CHARTREUSEColor

Initialize an immutable Color instance as CSS color # 7FFFF00.

(static, constant) CHOCOLATEColor

Initialize an immutable Color instance as CSS color # D2691E.

(static, constant) CORALColor

Initialize an immutable Color instance as CSS color # FF7F50.

(static, constant) CORNFLOWERBLUEColor

Initialize an immutable Color instance as CSS color # 6495ED.

(static, constant) CORNSILKColor

Initialize an immutable Color instance as CSS color # FFF8DC.

(static, constant) CRIMSONColor

Initialize an immutable Color instance as CSS color # DC143C.

(static, constant) CYANColor

Initialize an immutable Color instance as CSS color # 00FFFF.

(static, constant) DARKBLUEColor

Initialize an immutable Color instance as CSS color # 00008B.

(static, constant) DARKCYANColor

Initialize an immutable Color instance as CSS color # 008B8B.

(static, constant) DARKGOLDENRODColor

Initialize an immutable Color instance as CSS color # B8860B.

(static, constant) DARKGRAYColor

Initialize an immutable Color instance as CSS color # A9A9A9.

(static, constant) DARKGREENColor

Initialize an immutable Color instance as CSS color # 006400.

(static, constant) DARKGREYColor

Initialize an immutable Color instance as CSS color # A9A9A9.

(static, constant) DARKKHAKIColor

Initialize an immutable Color instance as CSS color # BDB76B.

(static, constant) DARKMAGENTAColor

Initialize an immutable Color instance as CSS color # 8B008B.

(static, constant) DARKOLIVEGREENColor

Initialize an immutable Color instance as CSS color # 556B2F.

(static, constant) DARKORANGEColor

Initialize an immutable Color instance as CSS color # FF8C00.

(static, constant) DARKORCHIDColor

Initialize an immutable Color instance as CSS color # 9932CC.

(static, constant) DARKREDColor

Initialize an immutable Color instance as CSS color # 8B0000.

(static, constant) DARKSALMONColor

Initialize an immutable Color instance as CSS color # E9967A.

(static, constant) DARKSEAGREENColor

Initialize an immutable Color instance as CSS color # 8FBC8F.

(static, constant) DARKSLATEBLUEColor

An immutable Color instance is initialized as CSS color # 483D8B.

(static, constant) DARKSLATEGRAYColor

Initialize an immutable Color instance as CSS color # 2F4F4F.

(static, constant) DARKTURQUOISEColor

Initialize an immutable Color instance as CSS color # 00CED1.

(static, constant) DARKVIOLETColor

Initialize an immutable Color instance as CSS color # 9400D3.

(static, constant) DEEPPINKColor

Initialize an immutable Color instance as CSS color # FF1493.

(static, constant) DEEPSKYBLUEColor

Initialize an immutable Color instance as CSS color # 00BFFF.

(static, constant) DIMGRAYColor

An immutable Color instance is initialized to CSS color # 696969.

(static, constant) DIMGREYColor

An immutable Color instance is initialized to CSS color # 696969.

(static, constant) DODGERBLUEColor

Initialize an immutable Color instance as CSS color # 1E90FF.

(static, constant) FIREBRICKColor

Initialize an immutable Color instance as CSS color # B22222.

(static, constant) FLORALWHITEColor

Initialize an immutable Color instance as CSS color # FFFAF0.

(static, constant) FORESTGREENColor

Initialize an immutable Color instance as CSS color # 228B22.

(static, constant) FUCHSIAColor

Initialize an immutable Color instance as CSS color # FF00FF.

(static, constant) GAINSBOROColor

An immutable Color instance is initialized as CSS color # DCDCC.

(static, constant) GHOSTWHITEColor

Initialize an immutable Color instance as CSS color # F8F8FF.

(static, constant) GOLDColor

Initialize an immutable Color instance as CSS color # FFD700.

(static, constant) GOLDENRODColor

Initialize an immutable Color instance as CSS color # DAA520.

(static, constant) GRAYColor

Initialize an immutable Color instance as CSS color # 808080.

(static, constant) GREENColor

Initialize an immutable Color instance as CSS color # 008000.

(static, constant) GREENYELLOWColor

Initialize an immutable Color instance as CSS color # ADFF2F.

(static, constant) GREYColor

Initialize an immutable Color instance as CSS color # 808080.

(static, constant) HONEYDEWColor

Initialize an immutable Color instance as CSS color # F0FFF0.

(static, constant) HOTPINKColor

Initialize an immutable Color instance as CSS color # FF69B4.

(static, constant) INDIANREDColor

Initialize an immutable Color instance as CSS color # CD5C5C.

(static, constant) INDIGOColor

Initialize an immutable Color instance as CSS color # 4B0082.

(static, constant) IVORYColor

Initialize an immutable Color instance as CSS color # FFFFF0.

(static, constant) KHAKIColor

Initialize an immutable Color instance as CSS color # F0E68C.

(static, constant) LAVENDAR_BLUSHColor

Initialize an immutable Color instance as CSS color # FFF0F5.

(static, constant) LAVENDERColor

Initialize an immutable Color instance as CSS color # E6E6FA.

(static, constant) LAWNGREENColor

An immutable Color instance is initialized as CSS color # 7CFC00.

(static, constant) LEMONCHIFFONColor

Initialize an immutable Color instance as CSS color # FFFACD.

(static, constant) LIGHTBLUEColor

Initialize an immutable Color instance as CSS color # ADD8E6.

(static, constant) LIGHTCORALColor

Initialize an immutable Color instance as CSS color # F08080.

(static, constant) LIGHTCYANColor

Initialize an immutable Color instance as CSS color # E0FFFF.

(static, constant) LIGHTGOLDENRODYELLOWColor

Initialize an immutable Color instance as CSS color # FAFAD2.

(static, constant) LIGHTGRAYColor

Initialize an immutable Color instance as CSS color # D3D3D3.

(static, constant) LIGHTGREENColor

Initialize an immutable Color instance as CSS color # 90EE90.

(static, constant) LIGHTGREYColor

Initialize an immutable Color instance as CSS color # D3D3D3.

(static, constant) LIGHTPINKColor

Initialize an immutable Color instance as CSS color # FFB6C1.

(static, constant) LIGHTSEAGREENColor

Initialize an immutable Color instance as CSS color # 20B2AA.

(static, constant) LIGHTSKYBLUEColor

Initialize an immutable Color instance as CSS color # 87CEFA.

(static, constant) LIGHTSLATEGRAYColor

Initialize an immutable Color instance as CSS color # 778899.

(static, constant) LIGHTSLATEGREYColor

Initialize an immutable Color instance as CSS color # 778899.

(static, constant) LIGHTSTEELBLUEColor

Initialize an immutable Color instance as CSS color # B0C4DE.

(static, constant) LIGHTYELLOWColor

Initialize an immutable Color instance as CSS color # FFFFE0.

(static, constant) LIMEColor

Initialize an immutable Color instance as CSS color # 00FF00.

(static, constant) LIMEGREENColor

Initialize an immutable Color instance as CSS color # 32CD32.

(static, constant) LINENColor

Initialize an immutable Color instance as CSS color # FAF0E6.

(static, constant) MAGENTAColor

Initialize an immutable Color instance as CSS color # FF00FF.

(static, constant) MAROONColor

Initialize an immutable Color instance as CSS color # 800000.

(static, constant) MEDIUMAQUAMARINEColor

Initialize an immutable Color instance as CSS color # 66CDAA.

(static, constant) MEDIUMBLUEColor

Initialize an immutable Color instance as CSS color # 0000CD.

(static, constant) MEDIUMORCHIDColor

Initialize an immutable Color instance as CSS color # BA55D3.

(static, constant) MEDIUMPURPLEColor

Initialize an immutable Color instance as CSS color # 9370DB.

(static, constant) MEDIUMSEAGREENColor

Initialize an immutable Color instance as CSS color # 3CB371.

(static, constant) MEDIUMSLATEBLUEColor

Initialize an immutable Color instance as CSS color # 7B68EE.

(static, constant) MEDIUMSPRINGGREENColor

Initialize an immutable Color instance as CSS color # 00FA9A.

(static, constant) MEDIUMTURQUOISEColor

Initialize an immutable Color instance as CSS color # 48D1CC.

(static, constant) MEDIUMVIOLETREDColor

Initialize an immutable Color instance as CSS color # C71585.

(static, constant) MIDNIGHTBLUEColor

Initialize an immutable Color instance as CSS color # 191970.

(static, constant) MINTCREAMColor

Initialize an immutable Color instance as CSS color # F5FFFA.

(static, constant) MISTYROSEColor

Initialize an immutable Color instance as CSS color # FFE4E1.

(static, constant) MOCCASINColor

Initialize an immutable Color instance as CSS color # FFE4B5.

(static, constant) NAVAJOWHITEColor

Initialize an immutable Color instance as CSS color # FFDEAD.

(static, constant) NAVYColor

Initialize an immutable Color instance as CSS color # 000080.

(static, constant) OLDLACEColor

Initialize an immutable Color instance as CSS color # FDF5E6.

(static, constant) OLIVEColor

Initialize an immutable Color instance as CSS color # 808000.

(static, constant) OLIVEDRABColor

Initialize an immutable Color instance as CSS color # 6B8E23.

(static, constant) ORANGEColor

Initialize an immutable Color instance as CSS color # FFA500.

(static, constant) ORANGEREDColor

Initialize an immutable Color instance as CSS color # FF4500.

(static, constant) ORCHIDColor

Initialize an immutable Color instance as CSS color # DA70D6.

static packedLengthNumber

The number of elements used to package an object into an array.

(static, constant) PALEGOLDENRODColor

Initialize an immutable Color instance as CSS color # EEE8AA.

(static, constant) PALEGREENColor

Initialize an immutable Color instance as CSS color # 98FB98.

(static, constant) PALETURQUOISEColor

Initialize an immutable Color instance as CSS color # AFEEEE.

(static, constant) PALEVIOLETREDColor

Initialize an immutable Color instance as CSS color # DB7093.

(static, constant) PAPAYAWHIPColor

Initialize an immutable Color instance as CSS color # FFEFD5.

(static, constant) PEACHPUFFColor

Initialize an immutable Color instance as CSS color # FFDAB9.

(static, constant) PERUColor

Initialize an immutable Color instance as CSS color # CD853F.

(static, constant) PINKColor

Initialize an immutable Color instance as CSS color # FFC0CB.

(static, constant) PLUMColor

Initialize an immutable Color instance as CSS color # DDAD0DD.

(static, constant) POWDERBLUEColor

Initialize an immutable Color instance as CSS color # B0E0E6.

(static, constant) PURPLEColor

Initialize an immutable Color instance as CSS color # 800080.

(static, constant) REDColor

Initialize an immutable Color instance as CSS color # FF0000.

(static, constant) ROSYBROWNColor

Initialize an immutable Color instance as CSS color # BC8F8F.

(static, constant) ROYALBLUEColor

An immutable Color instance is initialized as CSS color # 4169E1.

(static, constant) SADDLEBROWNColor

Initialize an immutable Color instance as CSS color # 8B4513.

(static, constant) SALMONColor

Initialize an immutable Color instance as CSS color # FA8072.

(static, constant) SANDYBROWNColor

Initialize an immutable Color instance as CSS color # F4A460.

(static, constant) SEAGREENColor

Initialize an immutable Color instance as CSS color # 2E B57.

(static, constant) SEASHELLColor

Initialize an immutable Color instance as CSS color # FFF5EE.

(static, constant) SIENNAColor

Initialize an immutable Color instance as CSS color # A0522D.

(static, constant) SILVERColor

Initialize an immutable Color instance as CSS color # C0C0C0.

(static, constant) SKYBLUEColor

Initialize an immutable Color instance as CSS color # 87CEEB.

(static, constant) SLATEBLUEColor

Initialize an immutable Color instance as CSS color # 6A5ACD.

(static, constant) SLATEGRAYColor

Initialize an immutable Color instance as CSS color # 708090.

(static, constant) SLATEGREYColor

Initialize an immutable Color instance as CSS color # 708090.

(static, constant) SNOWColor

Initialize an immutable Color instance as CSS color # FFFAFA.

(static, constant) SPRINGGREENColor

Initialize an immutable Color instance as CSS color # 00FF7F.

(static, constant) STEELBLUEColor

An immutable Color instance is initialized as CSS color # 4682B4.

(static, constant) TANColor

Initialize an immutable Color instance as CSS color # D2B48C.

(static, constant) TEALColor

Initialize an immutable Color instance as CSS color # 008080.

(static, constant) THISTLEColor

Initialize an immutable Color instance as CSS color # D8BFD8.

(static, constant) TOMATOColor

Initialize an immutable Color instance as CSS color # FF6347.

(static, constant) TRANSPARENTColor

Initialize an immutable Color instance to CSS transparency.

(static, constant) TURQUOISEColor

An immutable Color instance is initialized as CSS color # 40E0D0.

(static, constant) VIOLETColor

Initialize an immutable Color instance as CSS color # EE82EE.

(static, constant) WHEATColor

Initialize an immutable Color instance as CSS color # F5DEB3.

(static, constant) WHITEColor

Initialize an immutable Color instance as CSS color # FFFFFF.

(static, constant) WHITESMOKEColor

Initialize an immutable Color instance as CSS color # F5F5F5.

(static, constant) YELLOWColor

Initialize an immutable Color instance as CSS color # FFFF00.

(static, constant) YELLOWGREENColor

Initialize an immutable Color instance as CSS color # 9ACD32.

alphaNumber

Transparency section.

Default Value:
1.0

blueNumber

The blue part.

Default Value:
1.0

greenNumber

The green part.

Default Value:
1.0

redNumber

The red part.

Default Value:
1.0

Methods

static add(left, right, result){Color}

Calculate the total sum of two colors.

Name Type Description
left Color

The first color.

right Color

The second color.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static byteToFloat(number){Number}

Convert the 'byte' color portion within the range of 0 to 255 to the 'floating point' color portion within the range of 0 to 1.0.

Name Type Description
number Number

The color value that needs to be converted.

Returns:
Type Description
Number The converted color value.

static clone(color, result){Color}

Copy color.

Name Type Description
color Color

The color to be copied.

result Color optional

If the object for storing results is undefined, a new instance will be created.

Returns:
Type Description
Color The modified result parameter returns a new instance if the result is undefined. If the color is undefined, return undefined.

static divide(left, right, result){Color}

Calculate the partial quotient of two colors.

Name Type Description
left Color

The first color.

right Color

The second color.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static divideByScalar(color, scalar, result){Color}

Divide the provided color portion by the provided scalar.

Name Type Description
color Color

The color to be divided by.

scalar Number

The scalar to be divided by.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static equals(left, right){Boolean}

If the first color is equal to the second color, return true.

Name Type Description
left Color

The first color.

right Color

The second color.

Returns:
Type Description
Boolean If the colors are equal, it is true; Otherwise, it is false.

static floatToByte(number){Number}

Convert the 'floating point' color portion in the range of 0 to 1.0 to the 'byte' color portion in the range of 0 to 255.

Name Type Description
number Number

The color value that needs to be converted.

Returns:
Type Description
Number The converted color value.

static fromAlpha(color, alpha, result){Color}

Create a new Color with the same red, green, and blue parts as the specified color, but with the specified transparency value.

Name Type Description
color Color

Primary color.

alpha Number

New transparency value section.

result Color optional

The object that stores the results.

Returns:
Type Description
Color Modified result parameters or new Color instances (if not provided).
Example
var translucentRed = SuperMap3D.Color.fromAlpha(SuperMap3D.Color.RED, 0.9);

static fromBytes(red, green, blue, alpha, result){Color}

Create a new color specified with red, green, blue, and transparency values ranging from 0 to 255, and internally convert them to a range of 0.0 to 1.0.

Name Type Default Description
red Number 255 optional

The red part.

green Number 255 optional

The green part.

blue Number 255 optional

The blue part.

alpha Number 255 optional

Transparency section.

result Color optional

The object that stores the results.

Returns:
Type Description
Color Modified result parameters or new Color instances (if not provided).

static fromCartesian4(cartesian, result){Color}

Create a Color instance from Cartesian4. x. Y, z, and w are mapped to red, green, blue, and transparency, respectively.

Name Type Description
cartesian Cartesian4

Source Cartesian.

result Color optional

The object that stores the results.

Returns:
Type Description
Color Modified result parameters or new Color instances (if not provided).

static fromCssColorString(color, result){Color}

Create color instances based on CSS color values.

Name Type Description
color String

#CSS color values in rgb, # rgba, # rrggbb, # rrggbbaa, rgb(), rgba(), hsl(), or hsla() formats.

result Color optional

If the object for storing results is undefined, a new instance will be created.

See:
Returns:
Type Description
Color The color object is undefined if the string is not a valid CSS color.
Example
var cesiumBlue = SuperMap3D.Color.fromCssColorString('#67ADDF');
var green = SuperMap3D.Color.fromCssColorString('green');

static fromHsl(hue, saturation, lightness, alpha, result){Color}

Create a Color instance based on hue, saturation, and brightness.

Name Type Default Description
hue Number 0 optional

Hue value 0... 1

saturation Number 0 optional

Saturation value 0... 1

lightness Number 0 optional

Brightness value 0... 1

alpha Number 1.0 optional

Transparency value 0... 1

result Color optional

If the object storing the results is undefined, a new instance will be created

See:
Returns:
Type Description
Color Color object.

static fromRandom(result){Color}

Create random colors using the provided options. For repeatable random colors, call Math # setRandomNumberSeed once at the beginning of the application.

Name Type Default Description
options.red Number optional

If specified, use the red part instead of the random value.

options.minimumRed Number 0.0 optional

If not specified, the maximum red value generated.

options.maximumRed Number 1.0 optional

If not specified, the minimum red value generated.

options.green Number optional

If specified, use green components instead of random values.

options.minimumGreen Number 0.0 optional

If not specified, the maximum green value generated.

options.maximumGreen Number 1.0 optional

If not specified, the minimum green value generated.

options.blue Number optional

If specified, use the blue part instead of the random value.

options.minimumBlue Number 0.0 optional

If not specified, the maximum blue value generated.

options.maximumBlue Number 1.0 optional

If not specified, the minimum blue value generated.

options.alpha Number optional

If specified, use transparency value instead of random value.

options.minimumAlpha Number 0.0 optional

If not specified, the maximum transparency value generated.

options.maximumAlpha Number 1.0 optional

If not specified, the minimum transparency value generated.

result Color optional

If the object for storing results is undefined, a new instance will be created.

Throws:
  • Minimum Red must be less than or equal to maximum Red.

    Type
    DeveloperError
  • Minimum Green must be less than or equal to maximum Green.

    Type
    DeveloperError
  • The minimum value must be less than or equal to the maximum value.

    Type
    DeveloperError
  • The minimum alpha must be less than or equal to the maximum alpha.

    Type
    DeveloperError
Returns:
Type Description
Color The modified result parameter, if the result is undefined, is a new instance.
Example
//Create a completely random color
var color = SuperMap3D.Color.fromRandom();

//Create a random shade of yellow.
var color = SuperMap3D.Color.fromRandom({
    red : 1.0,
    green : 1.0,
    alpha : 1.0
});

//Create a random bright color.
var color = SuperMap3D.Color.fromRandom({
    minimumRed : 0.75,
    minimumGreen : 0.75,
    minimumBlue : 0.75,
    alpha : 1.0
});

static fromRgba(rgba, result){Color}

Create a new color from a single unsigned 32-bit RGBA value using the system's byte index.

Name Type Description
rgba Number

A single unsigned 32-bit RGBA value.

result Color optional

If the object for storing results is undefined, a new instance will be created.

See:
Returns:
Type Description
Color Color object.
Example
var color = SuperMap3D.Color.fromRgba(0x67ADDFFF);

static mod(left, right, result){Color}

Calculate the partial modulus of two colors.

Name Type Description
left Color

The first color.

right Color

The second color.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static multiply(left, right, result){Color}

Calculate the partial product of two colors.

Name Type Description
left Color

The first color.

right Color

The second color.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static multiplyByScalar(color, scalar, result){Color}

Multiply the provided color portion by the provided scalar.

Name Type Description
color Color

The colors that need to be multiplied.

scalar Number

The scalar to be multiplied with.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static pack(value, array, startingIndex){Array.<Number>}

Store the provided instance in the provided array.

Name Type Default Description
value Color

The value to be packaged.

array Array.<Number>

The array to be packaged.

startingIndex Number 0 optional

Start packaging the array index of elements.

Returns:
Type Description
Array.<Number> The loaded array.

static subtract(left, right, result){Color}

Calculate the partial difference between two colors.

Name Type Description
left Color

The first color.

right Color

The second color.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.

static unpack(array, startingIndex, result){Color}

Retrieve instances from the packaged array.

Name Type Default Description
array Array.<Number>

Packaged array.

startingIndex Number 0 optional

The starting index of the element to be unpacked.

result Color optional

The object that stores the results.

Returns:
Type Description
Color Modified result parameters or new Color instances (if not provided).

brighten(magnitude, result){Color}

Brighten this color according to the provided amplitude.

Name Type Description
magnitude Number

A positive number indicates the degree of brightness enhancement.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.
Example
var brightBlue = SuperMap3D.Color.BLUE.brighten(0.5, new SuperMap3D.Color());

clone(result){Color}

Return a copy of the color instance.

Name Type Description
result Color optional

If the object for storing results is undefined, a new instance will be created.

Returns:
Type Description
Color The modified result parameter, if the result is undefined, is a new instance.

darken(magnitude, result){Color}

Dim the color according to the provided amplitude.

Name Type Description
magnitude Number

A positive number indicates the degree of darkening.

result Color

The object that stores the results.

Returns:
Type Description
Color The modified result parameters.
Example
var darkBlue = SuperMap3D.Color.BLUE.darken(0.5, new SuperMap3D.Color());

equals(other){Boolean}

If this color is equal to other colors, return true.

Name Type Description
other Color

Colors that need to be compared.

Returns:
Type Description
Boolean If the colors are equal, it is true; Otherwise, it is false.

equalsEpsilon(other, epsilon){Boolean}

If this Color is equal to other parts within the specified epsilon, return true.

Name Type Default Description
other Color

Colors that need to be compared.

epsilon Number 0.0 optional

The epsilon used for equality testing.

Returns:
Type Description
Boolean If the colors are equal within the specified epsilon, it is true; Otherwise, it is false.

toBytes(result){Array.<Number>}

Convert this color to an array of red, green, blue, and transparency values ranging from 0 to 255.

Name Type Description
result Array.<Number> optional

An array for storing results, if undefined, will create a new instance.

Returns:
Type Description
Array.<Number> If the result is undefined, modify the result parameters or create a new instance.

toCssColorString(){String}

Create a string containing CSS color values for this color.

See:
Returns:
Type Description
String The CSS corresponding value for this color.

toRgba(){Number}

Convert the color to a single unsigned 32-bit RGBA value using the system's byte index.

See:
Returns:
Type Description
Number A single unsigned 32-bit RGBA value.
Example
var rgba = SuperMap3D.Color.BLUE.toRgba();

toString(){String}

Create a string representing this color in the format of '(red, green, blue, alpha)'.

Returns:
Type Description
String A string representing this color in the format of '(red, green, blue, alpha)'.

withAlpha(alpha, result){Color}

Create a new Color with the same red, green, and blue parts as this Color, but with a specified transparency value.

Name Type Description
alpha Number

The new alpha section.

result Color optional

The object that stores the results.

Returns:
Type Description
Color Modified result parameters or new Color instances (if not provided).
Example
var translucentRed = SuperMap3D.Color.RED.withAlpha(0.9);