new Color(redopt, greenopt, blueopt, alphaopt)
A color, specified using red, green, blue, and alpha values,
which range from
0
(no intensity) to 1.0
(full intensity).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
red |
Number |
<optional> |
1.0 | The red component. |
green |
Number |
<optional> |
1.0 | The green component. |
blue |
Number |
<optional> |
1.0 | The blue component. |
alpha |
Number |
<optional> |
1.0 | The alpha component. |
- Source:
- See:
-
- Packable
Members
(static, constant) ALICEBLUE :Color
An immutable Color instance initialized to CSS color #F0F8FF
Type:
- Source:
(static, constant) ANTIQUEWHITE :Color
An immutable Color instance initialized to CSS color #FAEBD7
Type:
- Source:
(static, constant) AQUA :Color
An immutable Color instance initialized to CSS color #00FFFF
Type:
- Source:
(static, constant) AQUAMARINE :Color
An immutable Color instance initialized to CSS color #7FFFD4
Type:
- Source:
(static, constant) AZURE :Color
An immutable Color instance initialized to CSS color #F0FFFF
Type:
- Source:
(static, constant) BEIGE :Color
An immutable Color instance initialized to CSS color #F5F5DC
Type:
- Source:
(static, constant) BISQUE :Color
An immutable Color instance initialized to CSS color #FFE4C4
Type:
- Source:
(static, constant) BLACK :Color
An immutable Color instance initialized to CSS color #000000
Type:
- Source:
(static, constant) BLANCHEDALMOND :Color
An immutable Color instance initialized to CSS color #FFEBCD
Type:
- Source:
(static, constant) BLUE :Color
An immutable Color instance initialized to CSS color #0000FF
Type:
- Source:
(static, constant) BLUEVIOLET :Color
An immutable Color instance initialized to CSS color #8A2BE2
Type:
- Source:
(static, constant) BROWN :Color
An immutable Color instance initialized to CSS color #A52A2A
Type:
- Source:
(static, constant) BURLYWOOD :Color
An immutable Color instance initialized to CSS color #DEB887
Type:
- Source:
(static, constant) CADETBLUE :Color
An immutable Color instance initialized to CSS color #5F9EA0
Type:
- Source:
(static, constant) CHARTREUSE :Color
An immutable Color instance initialized to CSS color #7FFF00
Type:
- Source:
(static, constant) CHOCOLATE :Color
An immutable Color instance initialized to CSS color #D2691E
Type:
- Source:
(static, constant) CORAL :Color
An immutable Color instance initialized to CSS color #FF7F50
Type:
- Source:
(static, constant) CORNFLOWERBLUE :Color
An immutable Color instance initialized to CSS color #6495ED
Type:
- Source:
(static, constant) CORNSILK :Color
An immutable Color instance initialized to CSS color #FFF8DC
Type:
- Source:
(static, constant) CRIMSON :Color
An immutable Color instance initialized to CSS color #DC143C
Type:
- Source:
(static, constant) CYAN :Color
An immutable Color instance initialized to CSS color #00FFFF
Type:
- Source:
(static, constant) DARKBLUE :Color
An immutable Color instance initialized to CSS color #00008B
Type:
- Source:
(static, constant) DARKCYAN :Color
An immutable Color instance initialized to CSS color #008B8B
Type:
- Source:
(static, constant) DARKGOLDENROD :Color
An immutable Color instance initialized to CSS color #B8860B
Type:
- Source:
(static, constant) DARKGRAY :Color
An immutable Color instance initialized to CSS color #A9A9A9
Type:
- Source:
(static, constant) DARKGREEN :Color
An immutable Color instance initialized to CSS color #006400
Type:
- Source:
(static, constant) DARKGREY :Color
An immutable Color instance initialized to CSS color #A9A9A9
Type:
- Source:
(static, constant) DARKKHAKI :Color
An immutable Color instance initialized to CSS color #BDB76B
Type:
- Source:
(static, constant) DARKMAGENTA :Color
An immutable Color instance initialized to CSS color #8B008B
Type:
- Source:
(static, constant) DARKOLIVEGREEN :Color
An immutable Color instance initialized to CSS color #556B2F
Type:
- Source:
(static, constant) DARKORANGE :Color
An immutable Color instance initialized to CSS color #FF8C00
Type:
- Source:
(static, constant) DARKORCHID :Color
An immutable Color instance initialized to CSS color #9932CC
Type:
- Source:
(static, constant) DARKRED :Color
An immutable Color instance initialized to CSS color #8B0000
Type:
- Source:
(static, constant) DARKSALMON :Color
An immutable Color instance initialized to CSS color #E9967A
Type:
- Source:
(static, constant) DARKSEAGREEN :Color
An immutable Color instance initialized to CSS color #8FBC8F
Type:
- Source:
(static, constant) DARKSLATEBLUE :Color
An immutable Color instance initialized to CSS color #483D8B
Type:
- Source:
(static, constant) DARKSLATEGRAY :Color
An immutable Color instance initialized to CSS color #2F4F4F
Type:
- Source:
(static, constant) DARKSLATEGREY :Color
An immutable Color instance initialized to CSS color #2F4F4F
Type:
- Source:
(static, constant) DARKTURQUOISE :Color
An immutable Color instance initialized to CSS color #00CED1
Type:
- Source:
(static, constant) DARKVIOLET :Color
An immutable Color instance initialized to CSS color #9400D3
Type:
- Source:
(static, constant) DEEPPINK :Color
An immutable Color instance initialized to CSS color #FF1493
Type:
- Source:
(static, constant) DEEPSKYBLUE :Color
An immutable Color instance initialized to CSS color #00BFFF
Type:
- Source:
(static, constant) DIMGRAY :Color
An immutable Color instance initialized to CSS color #696969
Type:
- Source:
(static, constant) DIMGREY :Color
An immutable Color instance initialized to CSS color #696969
Type:
- Source:
(static, constant) DODGERBLUE :Color
An immutable Color instance initialized to CSS color #1E90FF
Type:
- Source:
(static, constant) FIREBRICK :Color
An immutable Color instance initialized to CSS color #B22222
Type:
- Source:
(static, constant) FLORALWHITE :Color
An immutable Color instance initialized to CSS color #FFFAF0
Type:
- Source:
(static, constant) FORESTGREEN :Color
An immutable Color instance initialized to CSS color #228B22
Type:
- Source:
(static, constant) FUSCHIA :Color
An immutable Color instance initialized to CSS color #FF00FF
Type:
- Source:
(static, constant) GAINSBORO :Color
An immutable Color instance initialized to CSS color #DCDCDC
Type:
- Source:
(static, constant) GHOSTWHITE :Color
An immutable Color instance initialized to CSS color #F8F8FF
Type:
- Source:
(static, constant) GOLD :Color
An immutable Color instance initialized to CSS color #FFD700
Type:
- Source:
(static, constant) GOLDENROD :Color
An immutable Color instance initialized to CSS color #DAA520
Type:
- Source:
(static, constant) GRAY :Color
An immutable Color instance initialized to CSS color #808080
Type:
- Source:
(static, constant) GREEN :Color
An immutable Color instance initialized to CSS color #008000
Type:
- Source:
(static, constant) GREENYELLOW :Color
An immutable Color instance initialized to CSS color #ADFF2F
Type:
- Source:
(static, constant) GREY :Color
An immutable Color instance initialized to CSS color #808080
Type:
- Source:
(static, constant) HONEYDEW :Color
An immutable Color instance initialized to CSS color #F0FFF0
Type:
- Source:
(static, constant) HOTPINK :Color
An immutable Color instance initialized to CSS color #FF69B4
Type:
- Source:
(static, constant) INDIANRED :Color
An immutable Color instance initialized to CSS color #CD5C5C
Type:
- Source:
(static, constant) INDIGO :Color
An immutable Color instance initialized to CSS color #4B0082
Type:
- Source:
(static, constant) IVORY :Color
An immutable Color instance initialized to CSS color #FFFFF0
Type:
- Source:
(static, constant) KHAKI :Color
An immutable Color instance initialized to CSS color #F0E68C
Type:
- Source:
(static, constant) LAVENDAR_BLUSH :Color
An immutable Color instance initialized to CSS color #FFF0F5
Type:
- Source:
(static, constant) LAVENDER :Color
An immutable Color instance initialized to CSS color #E6E6FA
Type:
- Source:
(static, constant) LAWNGREEN :Color
An immutable Color instance initialized to CSS color #7CFC00
Type:
- Source:
(static, constant) LEMONCHIFFON :Color
An immutable Color instance initialized to CSS color #FFFACD
Type:
- Source:
(static, constant) LIGHTBLUE :Color
An immutable Color instance initialized to CSS color #ADD8E6
Type:
- Source:
(static, constant) LIGHTCORAL :Color
An immutable Color instance initialized to CSS color #F08080
Type:
- Source:
(static, constant) LIGHTCYAN :Color
An immutable Color instance initialized to CSS color #E0FFFF
Type:
- Source:
(static, constant) LIGHTGOLDENRODYELLOW :Color
An immutable Color instance initialized to CSS color #FAFAD2
Type:
- Source:
(static, constant) LIGHTGRAY :Color
An immutable Color instance initialized to CSS color #D3D3D3
Type:
- Source:
(static, constant) LIGHTGREEN :Color
An immutable Color instance initialized to CSS color #90EE90
Type:
- Source:
(static, constant) LIGHTGREY :Color
An immutable Color instance initialized to CSS color #D3D3D3
Type:
- Source:
(static, constant) LIGHTPINK :Color
An immutable Color instance initialized to CSS color #FFB6C1
Type:
- Source:
(static, constant) LIGHTSEAGREEN :Color
An immutable Color instance initialized to CSS color #20B2AA
Type:
- Source:
(static, constant) LIGHTSKYBLUE :Color
An immutable Color instance initialized to CSS color #87CEFA
Type:
- Source:
(static, constant) LIGHTSLATEGRAY :Color
An immutable Color instance initialized to CSS color #778899
Type:
- Source:
(static, constant) LIGHTSLATEGREY :Color
An immutable Color instance initialized to CSS color #778899
Type:
- Source:
(static, constant) LIGHTSTEELBLUE :Color
An immutable Color instance initialized to CSS color #B0C4DE
Type:
- Source:
(static, constant) LIGHTYELLOW :Color
An immutable Color instance initialized to CSS color #FFFFE0
Type:
- Source:
(static, constant) LIME :Color
An immutable Color instance initialized to CSS color #00FF00
Type:
- Source:
(static, constant) LIMEGREEN :Color
An immutable Color instance initialized to CSS color #32CD32
Type:
- Source:
(static, constant) LINEN :Color
An immutable Color instance initialized to CSS color #FAF0E6
Type:
- Source:
(static, constant) MAGENTA :Color
An immutable Color instance initialized to CSS color #FF00FF
Type:
- Source:
(static, constant) MAROON :Color
An immutable Color instance initialized to CSS color #800000
Type:
- Source:
(static, constant) MEDIUMAQUAMARINE :Color
An immutable Color instance initialized to CSS color #66CDAA
Type:
- Source:
(static, constant) MEDIUMBLUE :Color
An immutable Color instance initialized to CSS color #0000CD
Type:
- Source:
(static, constant) MEDIUMORCHID :Color
An immutable Color instance initialized to CSS color #BA55D3
Type:
- Source:
(static, constant) MEDIUMPURPLE :Color
An immutable Color instance initialized to CSS color #9370DB
Type:
- Source:
(static, constant) MEDIUMSEAGREEN :Color
An immutable Color instance initialized to CSS color #3CB371
Type:
- Source:
(static, constant) MEDIUMSLATEBLUE :Color
An immutable Color instance initialized to CSS color #7B68EE
Type:
- Source:
(static, constant) MEDIUMSPRINGGREEN :Color
An immutable Color instance initialized to CSS color #00FA9A
Type:
- Source:
(static, constant) MEDIUMTURQUOISE :Color
An immutable Color instance initialized to CSS color #48D1CC
Type:
- Source:
(static, constant) MEDIUMVIOLETRED :Color
An immutable Color instance initialized to CSS color #C71585
Type:
- Source:
(static, constant) MIDNIGHTBLUE :Color
An immutable Color instance initialized to CSS color #191970
Type:
- Source:
(static, constant) MINTCREAM :Color
An immutable Color instance initialized to CSS color #F5FFFA
Type:
- Source:
(static, constant) MISTYROSE :Color
An immutable Color instance initialized to CSS color #FFE4E1
Type:
- Source:
(static, constant) MOCCASIN :Color
An immutable Color instance initialized to CSS color #FFE4B5
Type:
- Source:
(static, constant) NAVAJOWHITE :Color
An immutable Color instance initialized to CSS color #FFDEAD
Type:
- Source:
(static, constant) NAVY :Color
An immutable Color instance initialized to CSS color #000080
Type:
- Source:
(static, constant) OLDLACE :Color
An immutable Color instance initialized to CSS color #FDF5E6
Type:
- Source:
(static, constant) OLIVE :Color
An immutable Color instance initialized to CSS color #808000
Type:
- Source:
(static, constant) OLIVEDRAB :Color
An immutable Color instance initialized to CSS color #6B8E23
Type:
- Source:
(static, constant) ORANGE :Color
An immutable Color instance initialized to CSS color #FFA500
Type:
- Source:
(static, constant) ORANGERED :Color
An immutable Color instance initialized to CSS color #FF4500
Type:
- Source:
(static, constant) ORCHID :Color
An immutable Color instance initialized to CSS color #DA70D6
Type:
- Source:
(static) packedLength :Number
The number of elements used to pack the object into an array.
Type:
- Number
- Source:
(static, constant) PALEGOLDENROD :Color
An immutable Color instance initialized to CSS color #EEE8AA
Type:
- Source:
(static, constant) PALEGREEN :Color
An immutable Color instance initialized to CSS color #98FB98
Type:
- Source:
(static, constant) PALETURQUOISE :Color
An immutable Color instance initialized to CSS color #AFEEEE
Type:
- Source:
(static, constant) PALEVIOLETRED :Color
An immutable Color instance initialized to CSS color #DB7093
Type:
- Source:
(static, constant) PAPAYAWHIP :Color
An immutable Color instance initialized to CSS color #FFEFD5
Type:
- Source:
(static, constant) PEACHPUFF :Color
An immutable Color instance initialized to CSS color #FFDAB9
Type:
- Source:
(static, constant) PERU :Color
An immutable Color instance initialized to CSS color #CD853F
Type:
- Source:
(static, constant) PINK :Color
An immutable Color instance initialized to CSS color #FFC0CB
Type:
- Source:
(static, constant) PLUM :Color
An immutable Color instance initialized to CSS color #DDA0DD
Type:
- Source:
(static, constant) POWDERBLUE :Color
An immutable Color instance initialized to CSS color #B0E0E6
Type:
- Source:
(static, constant) PURPLE :Color
An immutable Color instance initialized to CSS color #800080
Type:
- Source:
(static, constant) RED :Color
An immutable Color instance initialized to CSS color #FF0000
Type:
- Source:
(static, constant) ROSYBROWN :Color
An immutable Color instance initialized to CSS color #BC8F8F
Type:
- Source:
(static, constant) ROYALBLUE :Color
An immutable Color instance initialized to CSS color #4169E1
Type:
- Source:
(static, constant) SADDLEBROWN :Color
An immutable Color instance initialized to CSS color #8B4513
Type:
- Source:
(static, constant) SALMON :Color
An immutable Color instance initialized to CSS color #FA8072
Type:
- Source:
(static, constant) SANDYBROWN :Color
An immutable Color instance initialized to CSS color #F4A460
Type:
- Source:
(static, constant) SEAGREEN :Color
An immutable Color instance initialized to CSS color #2E8B57
Type:
- Source:
(static, constant) SEASHELL :Color
An immutable Color instance initialized to CSS color #FFF5EE
Type:
- Source:
(static, constant) SIENNA :Color
An immutable Color instance initialized to CSS color #A0522D
Type:
- Source:
(static, constant) SILVER :Color
An immutable Color instance initialized to CSS color #C0C0C0
Type:
- Source:
(static, constant) SKYBLUE :Color
An immutable Color instance initialized to CSS color #87CEEB
Type:
- Source:
(static, constant) SLATEBLUE :Color
An immutable Color instance initialized to CSS color #6A5ACD
Type:
- Source:
(static, constant) SLATEGRAY :Color
An immutable Color instance initialized to CSS color #708090
Type:
- Source:
(static, constant) SLATEGREY :Color
An immutable Color instance initialized to CSS color #708090
Type:
- Source:
(static, constant) SNOW :Color
An immutable Color instance initialized to CSS color #FFFAFA
Type:
- Source:
(static, constant) SPRINGGREEN :Color
An immutable Color instance initialized to CSS color #00FF7F
Type:
- Source:
(static, constant) STEELBLUE :Color
An immutable Color instance initialized to CSS color #4682B4
Type:
- Source:
(static, constant) TAN :Color
An immutable Color instance initialized to CSS color #D2B48C
Type:
- Source:
(static, constant) TEAL :Color
An immutable Color instance initialized to CSS color #008080
Type:
- Source:
(static, constant) THISTLE :Color
An immutable Color instance initialized to CSS color #D8BFD8
Type:
- Source:
(static, constant) TOMATO :Color
An immutable Color instance initialized to CSS color #FF6347
Type:
- Source:
(static, constant) TRANSPARENT :Color
An immutable Color instance initialized to CSS transparent.
Type:
- Source:
(static, constant) TURQUOISE :Color
An immutable Color instance initialized to CSS color #40E0D0
Type:
- Source:
(static, constant) VIOLET :Color
An immutable Color instance initialized to CSS color #EE82EE
Type:
- Source:
(static, constant) WHEAT :Color
An immutable Color instance initialized to CSS color #F5DEB3
Type:
- Source:
(static, constant) WHITE :Color
An immutable Color instance initialized to CSS color #FFFFFF
Type:
- Source:
(static, constant) WHITESMOKE :Color
An immutable Color instance initialized to CSS color #F5F5F5
Type:
- Source:
(static, constant) YELLOW :Color
An immutable Color instance initialized to CSS color #FFFF00
Type:
- Source:
(static, constant) YELLOWGREEN :Color
An immutable Color instance initialized to CSS color #9ACD32
Type:
- Source:
alpha :Number
The alpha component.
Type:
- Number
- Default Value:
- 1.0
- Source:
blue :Number
The blue component.
Type:
- Number
- Default Value:
- 1.0
- Source:
green :Number
The green component.
Type:
- Number
- Default Value:
- 1.0
- Source:
red :Number
The red component.
Type:
- Number
- Default Value:
- 1.0
- Source:
Methods
(static) add(left, right, result) → {Color}
Computes the componentwise sum of two Colors.
Parameters:
Name | Type | Description |
---|---|---|
left |
Color | The first Color. |
right |
Color | The second Color. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) byteToFloat(number) → {Number}
Converts a 'byte' color component in the range of 0 to 255 into
a 'float' color component in the range of 0 to 1.0.
Parameters:
Name | Type | Description |
---|---|---|
number |
Number | The number to be converted. |
- Source:
Returns:
The converted number.
- Type
- Number
(static) clone(color, resultopt) → {Color}
Duplicates a Color.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
color |
Color | The Color to duplicate. | |
result |
Color |
<optional> |
The object to store the result in, if undefined a new instance will be created. |
- Source:
Returns:
The modified result parameter or a new instance if result was undefined. (Returns undefined if color is undefined)
- Type
- Color
(static) divide(left, right, result) → {Color}
Computes the componentwise quotient of two Colors.
Parameters:
Name | Type | Description |
---|---|---|
left |
Color | The first Color. |
right |
Color | The second Color. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) divideByScalar(color, scalar, result) → {Color}
Divides the provided Color componentwise by the provided scalar.
Parameters:
Name | Type | Description |
---|---|---|
color |
Color | The Color to be divided. |
scalar |
Number | The scalar to divide with. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) equals(left, right) → {Boolean}
Returns true if the first Color equals the second color.
Parameters:
Name | Type | Description |
---|---|---|
left |
Color | The first Color to compare for equality. |
right |
Color | The second Color to compare for equality. |
- Source:
Returns:
true
if the Colors are equal; otherwise, false
.
- Type
- Boolean
(static) floatToByte(number) → {Number}
Converts a 'float' color component in the range of 0 to 1.0 into
a 'byte' color component in the range of 0 to 255.
Parameters:
Name | Type | Description |
---|---|---|
number |
Number | The number to be converted. |
- Source:
Returns:
The converted number.
- Type
- Number
(static) fromAlpha(color, alpha, resultopt) → {Color}
Creates a new Color that has the same red, green, and blue components
of the specified color, but with the specified alpha value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
color |
Color | The base color | |
alpha |
Number | The new alpha component. | |
result |
Color |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Color instance if one was not provided.
- Type
- Color
Example
var translucentRed = Cesium.Color.fromAlpha(Cesium.Color.RED, 0.9);
(static) fromBytes(redopt, greenopt, blueopt, alphaopt, resultopt) → {Color}
Creates a new Color specified using red, green, blue, and alpha values
that are in the range of 0 to 255, converting them internally to a range of 0.0 to 1.0.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
red |
Number |
<optional> |
255 | The red component. |
green |
Number |
<optional> |
255 | The green component. |
blue |
Number |
<optional> |
255 | The blue component. |
alpha |
Number |
<optional> |
255 | The alpha component. |
result |
Color |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Color instance if one was not provided.
- Type
- Color
(static) fromCartesian4(cartesian, resultopt) → {Color}
Creates a Color instance from a
Cartesian4
. x
, y
, z
,
and w
map to red
, green
, blue
, and alpha
, respectively.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cartesian |
Cartesian4 | The source cartesian. | |
result |
Color |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Color instance if one was not provided.
- Type
- Color
(static) fromCssColorString(color, resultopt) → {Color}
Creates a Color instance from a CSS color value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
color |
String | The CSS color value in #rgb, #rrggbb, rgb(), rgba(), hsl(), or hsla() format. | |
result |
Color |
<optional> |
The object to store the result in, if undefined a new instance will be created. |
- Source:
- See:
Returns:
The color object, or undefined if the string was not a valid CSS color.
- Type
- Color
Example
var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF');
var green = Cesium.Color.fromCssColorString('green');
(static) fromHsl(hueopt, saturationopt, lightnessopt, alphaopt, resultopt) → {Color}
Creates a Color instance from hue, saturation, and lightness.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
hue |
Number |
<optional> |
0 | The hue angle 0...1 |
saturation |
Number |
<optional> |
0 | The saturation value 0...1 |
lightness |
Number |
<optional> |
0 | The lightness value 0...1 |
alpha |
Number |
<optional> |
1.0 | The alpha component 0...1 |
result |
Color |
<optional> |
The object to store the result in, if undefined a new instance will be created. |
- Source:
- See:
Returns:
The color object.
- Type
- Color
(static) fromRandom(optionsopt, resultopt) → {Color}
Creates a random color using the provided options. For reproducible random colors, you should
call
CesiumMath#setRandomNumberSeed
once at the beginning of your application.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Object with the following properties:
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
result |
Color |
<optional> |
The object to store the result in, if undefined a new instance will be created. |
- Source:
Throws:
-
-
minimumRed must be less than or equal to maximumRed.
- Type
- DeveloperError
-
-
-
minimumGreen must be less than or equal to maximumGreen.
- Type
- DeveloperError
-
-
-
minimumBlue must be less than or equal to maximumBlue.
- Type
- DeveloperError
-
-
-
minimumAlpha must be less than or equal to maximumAlpha.
- Type
- DeveloperError
-
Returns:
The modified result parameter or a new instance if result was undefined.
- Type
- Color
Example
//Create a completely random color
var color = Cesium.Color.fromRandom();
//Create a random shade of yellow.
var color = Cesium.Color.fromRandom({
red : 1.0,
green : 1.0,
alpha : 1.0
});
//Create a random bright color.
var color = Cesium.Color.fromRandom({
minimumRed : 0.75,
minimumGreen : 0.75,
minimumBlue : 0.75,
alpha : 1.0
});
(static) fromRgba(rgba, resultopt) → {Color}
Creates a new Color from a single numeric unsigned 32-bit RGBA value, using the endianness
of the system.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rgba |
Number | A single numeric unsigned 32-bit RGBA value. | |
result |
Color |
<optional> |
The object to store the result in, if undefined a new instance will be created. |
- Source:
- See:
Returns:
The color object.
- Type
- Color
Example
var color = Cesium.Color.fromRgba(0x67ADDFFF);
(static) mod(left, right, result) → {Color}
Computes the componentwise modulus of two Colors.
Parameters:
Name | Type | Description |
---|---|---|
left |
Color | The first Color. |
right |
Color | The second Color. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) multiply(left, right, result) → {Color}
Computes the componentwise product of two Colors.
Parameters:
Name | Type | Description |
---|---|---|
left |
Color | The first Color. |
right |
Color | The second Color. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) multiplyByScalar(color, scalar, result) → {Color}
Multiplies the provided Color componentwise by the provided scalar.
Parameters:
Name | Type | Description |
---|---|---|
color |
Color | The Color to be scaled. |
scalar |
Number | The scalar to multiply with. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) pack(value, array, startingIndexopt) → {Array.<Number>}
Stores the provided instance into the provided array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Color | The value to pack. | ||
array |
Array.<Number> | The array to pack into. | ||
startingIndex |
Number |
<optional> |
0 | The index into the array at which to start packing the elements. |
- Source:
Returns:
The array that was packed into
- Type
- Array.<Number>
(static) subtract(left, right, result) → {Color}
Computes the componentwise difference of two Colors.
Parameters:
Name | Type | Description |
---|---|---|
left |
Color | The first Color. |
right |
Color | The second Color. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
(static) unpack(array, startingIndexopt, resultopt) → {Color}
Retrieves an instance from a packed array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array.<Number> | The packed array. | ||
startingIndex |
Number |
<optional> |
0 | The starting index of the element to be unpacked. |
result |
Color |
<optional> |
The object into which to store the result. |
- Source:
Returns:
The modified result parameter or a new Color instance if one was not provided.
- Type
- Color
brighten(magnitude, result) → {Color}
Brightens this color by the provided magnitude.
Parameters:
Name | Type | Description |
---|---|---|
magnitude |
Number | A positive number indicating the amount to brighten. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
Example
var brightBlue = Cesium.Color.BLUE.brighten(0.5, new Cesium.Color());
clone(resultopt) → {Color}
Returns a duplicate of a Color instance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
result |
Color |
<optional> |
The object to store the result in, if undefined a new instance will be created. |
- Source:
Returns:
The modified result parameter or a new instance if result was undefined.
- Type
- Color
darken(magnitude, result) → {Color}
Darkens this color by the provided magnitude.
Parameters:
Name | Type | Description |
---|---|---|
magnitude |
Number | A positive number indicating the amount to darken. |
result |
Color | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Color
Example
var darkBlue = Cesium.Color.BLUE.darken(0.5, new Cesium.Color());
equals(other) → {Boolean}
Returns true if this Color equals other.
Parameters:
Name | Type | Description |
---|---|---|
other |
Color | The Color to compare for equality. |
- Source:
Returns:
true
if the Colors are equal; otherwise, false
.
- Type
- Boolean
equalsEpsilon(other, epsilonopt) → {Boolean}
Returns
true
if this Color equals other componentwise within the specified epsilon.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
other |
Color | The Color to compare for equality. | ||
epsilon |
Number |
<optional> |
0.0 | The epsilon to use for equality testing. |
- Source:
Returns:
true
if the Colors are equal within the specified epsilon; otherwise, false
.
- Type
- Boolean
toBytes(resultopt) → {Array.<Number>}
Converts this color to an array of red, green, blue, and alpha values
that are in the range of 0 to 255.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
result |
Array.<Number> |
<optional> |
The array to store the result in, if undefined a new instance will be created. |
- Source:
Returns:
The modified result parameter or a new instance if result was undefined.
- Type
- Array.<Number>
toCssColorString() → {String}
Creates a string containing the CSS color value for this color.
- Source:
- See:
Returns:
The CSS equivalent of this color.
- Type
- String
toRgba() → {Number}
Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness
of the system.
- Source:
- See:
Returns:
A single numeric unsigned 32-bit RGBA value.
- Type
- Number
Example
var rgba = Cesium.Color.BLUE.toRgba();
toString() → {String}
Creates a string representing this Color in the format '(red, green, blue, alpha)'.
- Source:
Returns:
A string representing this Color in the format '(red, green, blue, alpha)'.
- Type
- String
withAlpha(alpha, resultopt) → {Color}
Creates a new Color that has the same red, green, and blue components
as this Color, but with the specified alpha value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
alpha |
Number | The new alpha component. | |
result |
Color |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Color instance if one was not provided.
- Type
- Color
Example
var translucentRed = Cesium.Color.RED.withAlpha(0.9);