new Color(red, green, blue, alpha)
A color, specified using red, green, blue, and alpha values,
which range from
0
(no intensity) to 1.0
(full intensity).
Name | Type | Default | Description |
---|---|---|---|
red |
Number |
1.0
|
optional The red component. |
green |
Number |
1.0
|
optional The green component. |
blue |
Number |
1.0
|
optional The blue component. |
alpha |
Number |
1.0
|
optional The alpha component. |
See:
Source:
Core/Color.js, line 50
Members
-
staticconstantColor.ALICEBLUE :Color
-
An immutable Color instance initialized to CSS color #F0F8FFSource: Core/Color.js, line 711
-
staticconstantColor.ANTIQUEWHITE :Color
-
An immutable Color instance initialized to CSS color #FAEBD7Source: Core/Color.js, line 720
-
staticconstantColor.AQUA :Color
-
An immutable Color instance initialized to CSS color #00FFFFSource: Core/Color.js, line 729
-
staticconstantColor.AQUAMARINE :Color
-
An immutable Color instance initialized to CSS color #7FFFD4Source: Core/Color.js, line 738
-
staticconstantColor.AZURE :Color
-
An immutable Color instance initialized to CSS color #F0FFFFSource: Core/Color.js, line 747
-
staticconstantColor.BEIGE :Color
-
An immutable Color instance initialized to CSS color #F5F5DCSource: Core/Color.js, line 756
-
staticconstantColor.BISQUE :Color
-
An immutable Color instance initialized to CSS color #FFE4C4Source: Core/Color.js, line 765
-
staticconstantColor.BLACK :Color
-
An immutable Color instance initialized to CSS color #000000Source: Core/Color.js, line 774
-
staticconstantColor.BLANCHEDALMOND :Color
-
An immutable Color instance initialized to CSS color #FFEBCDSource: Core/Color.js, line 783
-
staticconstantColor.BLUE :Color
-
An immutable Color instance initialized to CSS color #0000FFSource: Core/Color.js, line 792
-
staticconstantColor.BLUEVIOLET :Color
-
An immutable Color instance initialized to CSS color #8A2BE2Source: Core/Color.js, line 801
-
staticconstantColor.BROWN :Color
-
An immutable Color instance initialized to CSS color #A52A2ASource: Core/Color.js, line 810
-
staticconstantColor.BURLYWOOD :Color
-
An immutable Color instance initialized to CSS color #DEB887Source: Core/Color.js, line 819
-
staticconstantColor.CADETBLUE :Color
-
An immutable Color instance initialized to CSS color #5F9EA0Source: Core/Color.js, line 828
-
staticconstantColor.CHARTREUSE :Color
-
An immutable Color instance initialized to CSS color #7FFF00Source: Core/Color.js, line 836
-
staticconstantColor.CHOCOLATE :Color
-
An immutable Color instance initialized to CSS color #D2691ESource: Core/Color.js, line 845
-
staticconstantColor.CORAL :Color
-
An immutable Color instance initialized to CSS color #FF7F50Source: Core/Color.js, line 854
-
staticconstantColor.CORNFLOWERBLUE :Color
-
An immutable Color instance initialized to CSS color #6495EDSource: Core/Color.js, line 863
-
staticconstantColor.CORNSILK :Color
-
An immutable Color instance initialized to CSS color #FFF8DCSource: Core/Color.js, line 872
-
staticconstantColor.CRIMSON :Color
-
An immutable Color instance initialized to CSS color #DC143CSource: Core/Color.js, line 881
-
staticconstantColor.CYAN :Color
-
An immutable Color instance initialized to CSS color #00FFFFSource: Core/Color.js, line 890
-
staticconstantColor.DARKBLUE :Color
-
An immutable Color instance initialized to CSS color #00008BSource: Core/Color.js, line 899
-
staticconstantColor.DARKCYAN :Color
-
An immutable Color instance initialized to CSS color #008B8BSource: Core/Color.js, line 908
-
staticconstantColor.DARKGOLDENROD :Color
-
An immutable Color instance initialized to CSS color #B8860BSource: Core/Color.js, line 917
-
staticconstantColor.DARKGRAY :Color
-
An immutable Color instance initialized to CSS color #A9A9A9Source: Core/Color.js, line 926
-
staticconstantColor.DARKGREEN :Color
-
An immutable Color instance initialized to CSS color #006400Source: Core/Color.js, line 935
-
staticconstantColor.DARKGREY :Color
-
An immutable Color instance initialized to CSS color #A9A9A9Source: Core/Color.js, line 944
-
staticconstantColor.DARKKHAKI :Color
-
An immutable Color instance initialized to CSS color #BDB76BSource: Core/Color.js, line 953
-
staticconstantColor.DARKMAGENTA :Color
-
An immutable Color instance initialized to CSS color #8B008BSource: Core/Color.js, line 962
-
staticconstantColor.DARKOLIVEGREEN :Color
-
An immutable Color instance initialized to CSS color #556B2FSource: Core/Color.js, line 971
-
staticconstantColor.DARKORANGE :Color
-
An immutable Color instance initialized to CSS color #FF8C00Source: Core/Color.js, line 980
-
staticconstantColor.DARKORCHID :Color
-
An immutable Color instance initialized to CSS color #9932CCSource: Core/Color.js, line 989
-
staticconstantColor.DARKRED :Color
-
An immutable Color instance initialized to CSS color #8B0000Source: Core/Color.js, line 998
-
staticconstantColor.DARKSALMON :Color
-
An immutable Color instance initialized to CSS color #E9967ASource: Core/Color.js, line 1007
-
staticconstantColor.DARKSEAGREEN :Color
-
An immutable Color instance initialized to CSS color #8FBC8FSource: Core/Color.js, line 1016
-
staticconstantColor.DARKSLATEBLUE :Color
-
An immutable Color instance initialized to CSS color #483D8BSource: Core/Color.js, line 1025
-
staticconstantColor.DARKSLATEGRAY :Color
-
An immutable Color instance initialized to CSS color #2F4F4FSource: Core/Color.js, line 1034
-
staticconstantColor.DARKSLATEGREY :Color
-
An immutable Color instance initialized to CSS color #2F4F4FSource: Core/Color.js, line 1043
-
staticconstantColor.DARKTURQUOISE :Color
-
An immutable Color instance initialized to CSS color #00CED1Source: Core/Color.js, line 1052
-
staticconstantColor.DARKVIOLET :Color
-
An immutable Color instance initialized to CSS color #9400D3Source: Core/Color.js, line 1061
-
staticconstantColor.DEEPPINK :Color
-
An immutable Color instance initialized to CSS color #FF1493Source: Core/Color.js, line 1070
-
staticconstantColor.DEEPSKYBLUE :Color
-
An immutable Color instance initialized to CSS color #00BFFFSource: Core/Color.js, line 1079
-
staticconstantColor.DIMGRAY :Color
-
An immutable Color instance initialized to CSS color #696969Source: Core/Color.js, line 1088
-
staticconstantColor.DIMGREY :Color
-
An immutable Color instance initialized to CSS color #696969Source: Core/Color.js, line 1097
-
staticconstantColor.DODGERBLUE :Color
-
An immutable Color instance initialized to CSS color #1E90FFSource: Core/Color.js, line 1106
-
staticconstantColor.FIREBRICK :Color
-
An immutable Color instance initialized to CSS color #B22222Source: Core/Color.js, line 1115
-
staticconstantColor.FLORALWHITE :Color
-
An immutable Color instance initialized to CSS color #FFFAF0Source: Core/Color.js, line 1124
-
staticconstantColor.FORESTGREEN :Color
-
An immutable Color instance initialized to CSS color #228B22Source: Core/Color.js, line 1133
-
staticconstantColor.FUSCHIA :Color
-
An immutable Color instance initialized to CSS color #FF00FFSource: Core/Color.js, line 1142
-
staticconstantColor.GAINSBORO :Color
-
An immutable Color instance initialized to CSS color #DCDCDCSource: Core/Color.js, line 1151
-
staticconstantColor.GHOSTWHITE :Color
-
An immutable Color instance initialized to CSS color #F8F8FFSource: Core/Color.js, line 1160
-
staticconstantColor.GOLD :Color
-
An immutable Color instance initialized to CSS color #FFD700Source: Core/Color.js, line 1169
-
staticconstantColor.GOLDENROD :Color
-
An immutable Color instance initialized to CSS color #DAA520Source: Core/Color.js, line 1178
-
staticconstantColor.GRAY :Color
-
An immutable Color instance initialized to CSS color #808080Source: Core/Color.js, line 1187
-
staticconstantColor.GREEN :Color
-
An immutable Color instance initialized to CSS color #008000Source: Core/Color.js, line 1196
-
staticconstantColor.GREENYELLOW :Color
-
An immutable Color instance initialized to CSS color #ADFF2FSource: Core/Color.js, line 1205
-
staticconstantColor.GREY :Color
-
An immutable Color instance initialized to CSS color #808080Source: Core/Color.js, line 1214
-
staticconstantColor.HONEYDEW :Color
-
An immutable Color instance initialized to CSS color #F0FFF0Source: Core/Color.js, line 1223
-
staticconstantColor.HOTPINK :Color
-
An immutable Color instance initialized to CSS color #FF69B4Source: Core/Color.js, line 1232
-
staticconstantColor.INDIANRED :Color
-
An immutable Color instance initialized to CSS color #CD5C5CSource: Core/Color.js, line 1241
-
staticconstantColor.INDIGO :Color
-
An immutable Color instance initialized to CSS color #4B0082Source: Core/Color.js, line 1250
-
staticconstantColor.IVORY :Color
-
An immutable Color instance initialized to CSS color #FFFFF0Source: Core/Color.js, line 1259
-
staticconstantColor.KHAKI :Color
-
An immutable Color instance initialized to CSS color #F0E68CSource: Core/Color.js, line 1268
-
staticconstantColor.LAVENDAR_BLUSH :Color
-
An immutable Color instance initialized to CSS color #FFF0F5Source: Core/Color.js, line 1286
-
staticconstantColor.LAVENDER :Color
-
An immutable Color instance initialized to CSS color #E6E6FASource: Core/Color.js, line 1277
-
staticconstantColor.LAWNGREEN :Color
-
An immutable Color instance initialized to CSS color #7CFC00Source: Core/Color.js, line 1295
-
staticconstantColor.LEMONCHIFFON :Color
-
An immutable Color instance initialized to CSS color #FFFACDSource: Core/Color.js, line 1304
-
staticconstantColor.LIGHTBLUE :Color
-
An immutable Color instance initialized to CSS color #ADD8E6Source: Core/Color.js, line 1313
-
staticconstantColor.LIGHTCORAL :Color
-
An immutable Color instance initialized to CSS color #F08080Source: Core/Color.js, line 1322
-
staticconstantColor.LIGHTCYAN :Color
-
An immutable Color instance initialized to CSS color #E0FFFFSource: Core/Color.js, line 1331
-
staticconstantColor.LIGHTGOLDENRODYELLOW :Color
-
An immutable Color instance initialized to CSS color #FAFAD2Source: Core/Color.js, line 1340
-
staticconstantColor.LIGHTGRAY :Color
-
An immutable Color instance initialized to CSS color #D3D3D3Source: Core/Color.js, line 1349
-
staticconstantColor.LIGHTGREEN :Color
-
An immutable Color instance initialized to CSS color #90EE90Source: Core/Color.js, line 1358
-
staticconstantColor.LIGHTGREY :Color
-
An immutable Color instance initialized to CSS color #D3D3D3Source: Core/Color.js, line 1367
-
staticconstantColor.LIGHTPINK :Color
-
An immutable Color instance initialized to CSS color #FFB6C1Source: Core/Color.js, line 1376
-
staticconstantColor.LIGHTSEAGREEN :Color
-
An immutable Color instance initialized to CSS color #20B2AASource: Core/Color.js, line 1385
-
staticconstantColor.LIGHTSKYBLUE :Color
-
An immutable Color instance initialized to CSS color #87CEFASource: Core/Color.js, line 1394
-
staticconstantColor.LIGHTSLATEGRAY :Color
-
An immutable Color instance initialized to CSS color #778899Source: Core/Color.js, line 1403
-
staticconstantColor.LIGHTSLATEGREY :Color
-
An immutable Color instance initialized to CSS color #778899Source: Core/Color.js, line 1412
-
staticconstantColor.LIGHTSTEELBLUE :Color
-
An immutable Color instance initialized to CSS color #B0C4DESource: Core/Color.js, line 1421
-
staticconstantColor.LIGHTYELLOW :Color
-
An immutable Color instance initialized to CSS color #FFFFE0Source: Core/Color.js, line 1430
-
staticconstantColor.LIME :Color
-
An immutable Color instance initialized to CSS color #00FF00Source: Core/Color.js, line 1439
-
staticconstantColor.LIMEGREEN :Color
-
An immutable Color instance initialized to CSS color #32CD32Source: Core/Color.js, line 1448
-
staticconstantColor.LINEN :Color
-
An immutable Color instance initialized to CSS color #FAF0E6Source: Core/Color.js, line 1457
-
staticconstantColor.MAGENTA :Color
-
An immutable Color instance initialized to CSS color #FF00FFSource: Core/Color.js, line 1466
-
staticconstantColor.MAROON :Color
-
An immutable Color instance initialized to CSS color #800000Source: Core/Color.js, line 1475
-
staticconstantColor.MEDIUMAQUAMARINE :Color
-
An immutable Color instance initialized to CSS color #66CDAASource: Core/Color.js, line 1484
-
staticconstantColor.MEDIUMBLUE :Color
-
An immutable Color instance initialized to CSS color #0000CDSource: Core/Color.js, line 1493
-
staticconstantColor.MEDIUMORCHID :Color
-
An immutable Color instance initialized to CSS color #BA55D3Source: Core/Color.js, line 1502
-
staticconstantColor.MEDIUMPURPLE :Color
-
An immutable Color instance initialized to CSS color #9370DBSource: Core/Color.js, line 1511
-
staticconstantColor.MEDIUMSEAGREEN :Color
-
An immutable Color instance initialized to CSS color #3CB371Source: Core/Color.js, line 1520
-
staticconstantColor.MEDIUMSLATEBLUE :Color
-
An immutable Color instance initialized to CSS color #7B68EESource: Core/Color.js, line 1529
-
staticconstantColor.MEDIUMSPRINGGREEN :Color
-
An immutable Color instance initialized to CSS color #00FA9ASource: Core/Color.js, line 1538
-
staticconstantColor.MEDIUMTURQUOISE :Color
-
An immutable Color instance initialized to CSS color #48D1CCSource: Core/Color.js, line 1547
-
staticconstantColor.MEDIUMVIOLETRED :Color
-
An immutable Color instance initialized to CSS color #C71585Source: Core/Color.js, line 1556
-
staticconstantColor.MIDNIGHTBLUE :Color
-
An immutable Color instance initialized to CSS color #191970Source: Core/Color.js, line 1565
-
staticconstantColor.MINTCREAM :Color
-
An immutable Color instance initialized to CSS color #F5FFFASource: Core/Color.js, line 1574
-
staticconstantColor.MISTYROSE :Color
-
An immutable Color instance initialized to CSS color #FFE4E1Source: Core/Color.js, line 1583
-
staticconstantColor.MOCCASIN :Color
-
An immutable Color instance initialized to CSS color #FFE4B5Source: Core/Color.js, line 1592
-
staticconstantColor.NAVAJOWHITE :Color
-
An immutable Color instance initialized to CSS color #FFDEADSource: Core/Color.js, line 1601
-
staticconstantColor.NAVY :Color
-
An immutable Color instance initialized to CSS color #000080Source: Core/Color.js, line 1610
-
staticconstantColor.OLDLACE :Color
-
An immutable Color instance initialized to CSS color #FDF5E6Source: Core/Color.js, line 1619
-
staticconstantColor.OLIVE :Color
-
An immutable Color instance initialized to CSS color #808000Source: Core/Color.js, line 1628
-
staticconstantColor.OLIVEDRAB :Color
-
An immutable Color instance initialized to CSS color #6B8E23Source: Core/Color.js, line 1637
-
staticconstantColor.ORANGE :Color
-
An immutable Color instance initialized to CSS color #FFA500Source: Core/Color.js, line 1646
-
staticconstantColor.ORANGERED :Color
-
An immutable Color instance initialized to CSS color #FF4500Source: Core/Color.js, line 1655
-
staticconstantColor.ORCHID :Color
-
An immutable Color instance initialized to CSS color #DA70D6Source: Core/Color.js, line 1664
-
staticColor.packedLength :Number
-
The number of elements used to pack the object into an array.Source: Core/Color.js, line 412
-
staticconstantColor.PALEGOLDENROD :Color
-
An immutable Color instance initialized to CSS color #EEE8AASource: Core/Color.js, line 1673
-
staticconstantColor.PALEGREEN :Color
-
An immutable Color instance initialized to CSS color #98FB98Source: Core/Color.js, line 1682
-
staticconstantColor.PALETURQUOISE :Color
-
An immutable Color instance initialized to CSS color #AFEEEESource: Core/Color.js, line 1691
-
staticconstantColor.PALEVIOLETRED :Color
-
An immutable Color instance initialized to CSS color #DB7093Source: Core/Color.js, line 1700
-
staticconstantColor.PAPAYAWHIP :Color
-
An immutable Color instance initialized to CSS color #FFEFD5Source: Core/Color.js, line 1709
-
staticconstantColor.PEACHPUFF :Color
-
An immutable Color instance initialized to CSS color #FFDAB9Source: Core/Color.js, line 1718
-
staticconstantColor.PERU :Color
-
An immutable Color instance initialized to CSS color #CD853FSource: Core/Color.js, line 1727
-
staticconstantColor.PINK :Color
-
An immutable Color instance initialized to CSS color #FFC0CBSource: Core/Color.js, line 1736
-
staticconstantColor.PLUM :Color
-
An immutable Color instance initialized to CSS color #DDA0DDSource: Core/Color.js, line 1745
-
staticconstantColor.POWDERBLUE :Color
-
An immutable Color instance initialized to CSS color #B0E0E6Source: Core/Color.js, line 1754
-
staticconstantColor.PURPLE :Color
-
An immutable Color instance initialized to CSS color #800080Source: Core/Color.js, line 1763
-
staticconstantColor.RED :Color
-
An immutable Color instance initialized to CSS color #FF0000Source: Core/Color.js, line 1772
-
staticconstantColor.ROSYBROWN :Color
-
An immutable Color instance initialized to CSS color #BC8F8FSource: Core/Color.js, line 1781
-
staticconstantColor.ROYALBLUE :Color
-
An immutable Color instance initialized to CSS color #4169E1Source: Core/Color.js, line 1790
-
staticconstantColor.SADDLEBROWN :Color
-
An immutable Color instance initialized to CSS color #8B4513Source: Core/Color.js, line 1799
-
staticconstantColor.SALMON :Color
-
An immutable Color instance initialized to CSS color #FA8072Source: Core/Color.js, line 1808
-
staticconstantColor.SANDYBROWN :Color
-
An immutable Color instance initialized to CSS color #F4A460Source: Core/Color.js, line 1817
-
staticconstantColor.SEAGREEN :Color
-
An immutable Color instance initialized to CSS color #2E8B57Source: Core/Color.js, line 1826
-
staticconstantColor.SEASHELL :Color
-
An immutable Color instance initialized to CSS color #FFF5EESource: Core/Color.js, line 1835
-
staticconstantColor.SIENNA :Color
-
An immutable Color instance initialized to CSS color #A0522DSource: Core/Color.js, line 1844
-
staticconstantColor.SILVER :Color
-
An immutable Color instance initialized to CSS color #C0C0C0Source: Core/Color.js, line 1853
-
staticconstantColor.SKYBLUE :Color
-
An immutable Color instance initialized to CSS color #87CEEBSource: Core/Color.js, line 1862
-
staticconstantColor.SLATEBLUE :Color
-
An immutable Color instance initialized to CSS color #6A5ACDSource: Core/Color.js, line 1871
-
staticconstantColor.SLATEGRAY :Color
-
An immutable Color instance initialized to CSS color #708090Source: Core/Color.js, line 1880
-
staticconstantColor.SLATEGREY :Color
-
An immutable Color instance initialized to CSS color #708090Source: Core/Color.js, line 1889
-
staticconstantColor.SNOW :Color
-
An immutable Color instance initialized to CSS color #FFFAFASource: Core/Color.js, line 1898
-
staticconstantColor.SPRINGGREEN :Color
-
An immutable Color instance initialized to CSS color #00FF7FSource: Core/Color.js, line 1907
-
staticconstantColor.STEELBLUE :Color
-
An immutable Color instance initialized to CSS color #4682B4Source: Core/Color.js, line 1916
-
staticconstantColor.TAN :Color
-
An immutable Color instance initialized to CSS color #D2B48CSource: Core/Color.js, line 1925
-
staticconstantColor.TEAL :Color
-
An immutable Color instance initialized to CSS color #008080Source: Core/Color.js, line 1934
-
staticconstantColor.THISTLE :Color
-
An immutable Color instance initialized to CSS color #D8BFD8Source: Core/Color.js, line 1943
-
staticconstantColor.TOMATO :Color
-
An immutable Color instance initialized to CSS color #FF6347Source: Core/Color.js, line 1952
-
staticconstantColor.TURQUOISE :Color
-
An immutable Color instance initialized to CSS color #40E0D0Source: Core/Color.js, line 1961
-
staticconstantColor.VIOLET :Color
-
An immutable Color instance initialized to CSS color #EE82EESource: Core/Color.js, line 1970
-
staticconstantColor.WHEAT :Color
-
An immutable Color instance initialized to CSS color #F5DEB3Source: Core/Color.js, line 1979
-
staticconstantColor.WHITE :Color
-
An immutable Color instance initialized to CSS color #FFFFFFSource: Core/Color.js, line 1988
-
staticconstantColor.WHITESMOKE :Color
-
An immutable Color instance initialized to CSS color #F5F5F5Source: Core/Color.js, line 1997
-
staticconstantColor.YELLOW :Color
-
An immutable Color instance initialized to CSS color #FFFF00Source: Core/Color.js, line 2006
-
staticconstantColor.YELLOWGREEN :Color
-
An immutable Color instance initialized to CSS color #9ACD32Source: Core/Color.js, line 2015
-
alpha :Number
-
The alpha component.
-
Default Value:
1.0
Source: Core/Color.js, line 74 -
blue :Number
-
The blue component.
-
Default Value:
1.0
Source: Core/Color.js, line 68 -
green :Number
-
The green component.
-
Default Value:
1.0
Source: Core/Color.js, line 62 -
red :Number
-
The red component.
-
Default Value:
1.0
Source: Core/Color.js, line 56
Methods
-
staticColor.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.
Name Type Description number
Number The number to be converted. Returns:
The converted number.Source: Core/Color.js, line 470 -
staticColor.clone(color, result) → Color
-
Duplicates a Color.
Name Type 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. Returns:
The modified result parameter or a new instance if result was undefined. (Returns undefined if color is undefined)Source: Core/Color.js, line 492 -
staticColor.equals(left, right) → Boolean
-
Returns true if the first Color equals the second color.
Name Type Description left
Color The first Color to compare for equality. right
Color The second Color to compare for equality. Returns:
true
if the Colors are equal; otherwise,false
.Source: Core/Color.js, line 513 -
staticColor.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.
Name Type Description number
Number The number to be converted. Returns:
The converted number.Source: Core/Color.js, line 481 -
staticColor.fromAlpha(color, alpha, result) → Color
-
Creates a new Color that has the same red, green, and blue components of the specified color, but with the specified alpha value.
Name Type Description color
Color The base color alpha
Number The new alpha component. result
Color optional The object onto which to store the result. Returns:
The modified result parameter or a new Color instance if one was not provided.Example:
var translucentRed = Cesium.Color.fromColor(Cesium.Color.RED, 0.9);
Source: Core/Color.js, line 142 -
staticColor.fromBytes(red, green, blue, alpha, result) → 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.
Name Type Default Description red
Number 255
optional The red component. green
Number 255
optional The green component. blue
Number 255
optional The blue component. alpha
Number 255
optional The alpha component. result
Color optional The object onto which to store the result. Returns:
The modified result parameter or a new Color instance if one was not provided.Source: Core/Color.js, line 114 -
staticColor.fromCartesian4(cartesian, result) → Color
-
Creates a Color instance from a
Cartesian4
.x
,y
,z
, andw
map tored
,green
,blue
, andalpha
, respectively.Name Type Description cartesian
Cartesian4 The source cartesian. result
Color optional The object onto which to store the result. Returns:
The modified result parameter or a new Color instance if one was not provided.Source: Core/Color.js, line 85 -
staticColor.fromCssColorString(color) → Color
-
Creates a Color instance from a CSS color value.
Name Type Description color
String The CSS color value in #rgb, #rrggbb, rgb(), rgba(), hsl(), or hsla() format. Returns:
The color object, or undefined if the string was not a valid CSS color.Example:
var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF'); var green = Cesium.Color.fromCssColorString('green');
See:
Source: Core/Color.js, line 363 -
staticColor.fromHsl(hue, saturation, lightness, alpha) → Color
-
Creates a Color instance from hue, saturation, and lightness.
Name Type Default Description hue
Number 0
optional The hue angle 0...1 saturation
Number 0
optional The saturation value 0...1 lightness
Number 0
optional The lightness value 0...1 alpha
Number 1.0
optional The alpha component 0...1 Returns:
The color object.See:
Source: Core/Color.js, line 201 -
staticColor.fromRandom(options, result) → 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.Name Type Description options
Object optional Object with the following properties: Name Type Default Description red
Number optional If specified, the red component to use instead of a randomized value. minimumRed
Number 0.0
optional The maximum red value to generate if none was specified. maximumRed
Number 1.0
optional The minimum red value to generate if none was specified. green
Number optional If specified, the green component to use instead of a randomized value. minimumGreen
Number 0.0
optional The maximum green value to generate if none was specified. maximumGreen
Number 1.0
optional The minimum green value to generate if none was specified. blue
Number optional If specified, the blue component to use instead of a randomized value. minimumBlue
Number 0.0
optional The maximum blue value to generate if none was specified. maximumBlue
Number 1.0
optional The minimum blue value to generate if none was specified. alpha
Number optional If specified, the alpha component to use instead of a randomized value. minimumAlpha
Number 0.0
optional The maximum alpha value to generate if none was specified. maximumAlpha
Number 1.0
optional The minimum alpha value to generate if none was specified. result
Color optional The object to store the result in, if undefined a new instance will be created. Returns:
The modified result parameter or a new instance if result was undefined.Throws:
-
DeveloperError : minimumRed must be less than or equal to maximumRed.
-
DeveloperError : minimumGreen must be less than or equal to maximumGreen.
-
DeveloperError : minimumBlue must be less than or equal to maximumBlue.
-
DeveloperError : minimumAlpha must be less than or equal to maximumAlpha.
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 });
Source: Core/Color.js, line 272 -
-
staticColor.fromRgba(rgba) → Color
-
Creates a new Color from a single numeric unsigned 32-bit RGBA value, using the endianness of the system.
Name Type Description rgba
Number A single numeric unsigned 32-bit RGBA value. Returns:
A new color instance.Example:
var color = Cesium.Color.fromRgba(0x67ADDFFF);
See:
Source: Core/Color.js, line 184 -
staticColor.pack(value, array, startingIndex)
-
Stores the provided instance into the provided array.
Name Type Default Description value
Color The value to pack. array
Array.<Number> The array to pack into. startingIndex
Number 0
optional The index into the array at which to start packing the elements. Source: Core/Color.js, line 421 -
staticColor.unpack(array, startingIndex, result)
-
Retrieves an instance from a packed array.
Name Type Default Description array
Array.<Number> The packed array. startingIndex
Number 0
optional The starting index of the element to be unpacked. result
Color optional The object into which to store the result. Source: Core/Color.js, line 445 -
brighten(magnitude, result) → Color
-
Brightens this color by the provided magnitude.
Name Type Description magnitude
Number A positive number indicating the amount to brighten. result
Color The object onto which to store the result. Returns:
The modified result parameter.Example:
var brightBlue = Cesium.Color.BLUE.brighten(0.5, new Color());
Source: Core/Color.js, line 638 -
clone(result) → Color
-
Returns a duplicate of a Color instance.
Name Type Description result
Color optional The object to store the result in, if undefined a new instance will be created. Returns:
The modified result parameter or a new instance if result was undefined.Source: Core/Color.js, line 529 -
darken(magnitude, result) → Color
-
Darkens this color by the provided magnitude.
Name Type Description magnitude
Number A positive number indicating the amount to darken. result
Color The object onto which to store the result. Returns:
The modified result parameter.Example:
var darkBlue = Cesium.Color.BLUE.darken(0.5, new Color());
Source: Core/Color.js, line 669 -
equals(other) → Boolean
-
Returns true if this Color equals other.
Name Type Description other
Color The Color to compare for equality. Returns:
true
if the Colors are equal; otherwise,false
.Source: Core/Color.js, line 539 -
equalsEpsilon(other, epsilon) → Boolean
-
Returns
true
if this Color equals other componentwise within the specified epsilon.Name Type Default Description other
Color The Color to compare for equality. epsilon
Number 0.0
optional The epsilon to use for equality testing. Returns:
true
if the Colors are equal within the specified epsilon; otherwise,false
.Source: Core/Color.js, line 550 -
toBytes(result) → Array.<Number>
-
Converts this color to an array of red, green, blue, and alpha values that are in the range of 0 to 255.
Name Type Description result
Array.<Number> optional The array to store the result in, if undefined a new instance will be created. Returns:
The modified result parameter or a new instance if result was undefined.Source: Core/Color.js, line 592 -
toCssColorString() → String
-
Creates a string containing the CSS color value for this color.
Returns:
The CSS equivalent of this color.See:
Source: Core/Color.js, line 575 -
toRgba() → Number
-
Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness of the system.
Returns:
A single numeric unsigned 32-bit RGBA value.Example:
var rgba = Cesium.Color.BLUE.toRgba();
See:
Source: Core/Color.js, line 619 -
toString() → String
-
Creates a string representing this Color in the format '(red, green, blue, alpha)'.
Returns:
A string representing this Color in the format '(red, green, blue, alpha)'.Source: Core/Color.js, line 564 -
withAlpha(alpha, result) → Color
-
Creates a new Color that has the same red, green, and blue components as this Color, but with the specified alpha value.
Name Type Description alpha
Number The new alpha component. result
Color optional The object onto which to store the result. Returns:
The modified result parameter or a new Color instance if one was not provided.Example:
var translucentRed = Cesium.Color.RED.withAlpha(0.9);
Source: Core/Color.js, line 700