麻辣GIS微信平台

更多 GIS 干货

微信关注不错过

Cesium API - Color 中文文档

本文介绍下Cesium中 Color API的详细使用说明。

Color API 调用方法

new Cesium.Color(red, green, blue, alpha)
使用红色、绿色、蓝色和alpha值指定的颜色,范围从0(无强度)到1.0(全强度)。
Name Type Default Description
red Number 1.0 optional 红色分量。
green Number 1.0 optional 绿色分量。
blue Number 1.0 optional 蓝色分量。
alpha Number 1.0 optional alpha分量。
参考:

成员变量

staticconstantCesium.Color.ALICEBLUE : Color
An immutable Color instance initialized to CSS color #F0F8FF
staticconstantCesium.Color.ANTIQUEWHITE : Color
An immutable Color instance initialized to CSS color #FAEBD7
staticconstantCesium.Color.AQUA : Color
An immutable Color instance initialized to CSS color #00FFFF
staticconstantCesium.Color.AQUAMARINE : Color
An immutable Color instance initialized to CSS color #7FFFD4
staticconstantCesium.Color.AZURE : Color
An immutable Color instance initialized to CSS color #F0FFFF
staticconstantCesium.Color.BEIGE : Color
An immutable Color instance initialized to CSS color #F5F5DC
staticconstantCesium.Color.BISQUE : Color
An immutable Color instance initialized to CSS color #FFE4C4
staticconstantCesium.Color.BLACK : Color
An immutable Color instance initialized to CSS color #000000
staticconstantCesium.Color.BLANCHEDALMOND : Color
An immutable Color instance initialized to CSS color #FFEBCD
staticconstantCesium.Color.BLUE : Color
An immutable Color instance initialized to CSS color #0000FF
staticconstantCesium.Color.BLUEVIOLET : Color
An immutable Color instance initialized to CSS color #8A2BE2
staticconstantCesium.Color.BROWN : Color
An immutable Color instance initialized to CSS color #A52A2A
staticconstantCesium.Color.BURLYWOOD : Color
An immutable Color instance initialized to CSS color #DEB887
staticconstantCesium.Color.CADETBLUE : Color
An immutable Color instance initialized to CSS color #5F9EA0
staticconstantCesium.Color.CHARTREUSE : Color
An immutable Color instance initialized to CSS color #7FFF00
staticconstantCesium.Color.CHOCOLATE : Color
An immutable Color instance initialized to CSS color #D2691E
staticconstantCesium.Color.CORAL : Color
An immutable Color instance initialized to CSS color #FF7F50
staticconstantCesium.Color.CORNFLOWERBLUE : Color
An immutable Color instance initialized to CSS color #6495ED
staticconstantCesium.Color.CORNSILK : Color
An immutable Color instance initialized to CSS color #FFF8DC
staticconstantCesium.Color.CRIMSON : Color
An immutable Color instance initialized to CSS color #DC143C
staticconstantCesium.Color.CYAN : Color
An immutable Color instance initialized to CSS color #00FFFF
staticconstantCesium.Color.DARKBLUE : Color
An immutable Color instance initialized to CSS color #00008B
staticconstantCesium.Color.DARKCYAN : Color
An immutable Color instance initialized to CSS color #008B8B
staticconstantCesium.Color.DARKGOLDENROD : Color
An immutable Color instance initialized to CSS color #B8860B
staticconstantCesium.Color.DARKGRAY : Color
An immutable Color instance initialized to CSS color #A9A9A9
staticconstantCesium.Color.DARKGREEN : Color
An immutable Color instance initialized to CSS color #006400
staticconstantCesium.Color.DARKGREY : Color
An immutable Color instance initialized to CSS color #A9A9A9
staticconstantCesium.Color.DARKKHAKI : Color
An immutable Color instance initialized to CSS color #BDB76B
staticconstantCesium.Color.DARKMAGENTA : Color
An immutable Color instance initialized to CSS color #8B008B
staticconstantCesium.Color.DARKOLIVEGREEN : Color
An immutable Color instance initialized to CSS color #556B2F
staticconstantCesium.Color.DARKORANGE : Color
An immutable Color instance initialized to CSS color #FF8C00
staticconstantCesium.Color.DARKORCHID : Color
An immutable Color instance initialized to CSS color #9932CC
staticconstantCesium.Color.DARKRED : Color
An immutable Color instance initialized to CSS color #8B0000
staticconstantCesium.Color.DARKSALMON : Color
An immutable Color instance initialized to CSS color #E9967A
staticconstantCesium.Color.DARKSEAGREEN : Color
An immutable Color instance initialized to CSS color #8FBC8F
staticconstantCesium.Color.DARKSLATEBLUE : Color
An immutable Color instance initialized to CSS color #483D8B
staticconstantCesium.Color.DARKSLATEGRAY : Color
An immutable Color instance initialized to CSS color #2F4F4F
staticconstantCesium.Color.DARKSLATEGREY : Color
An immutable Color instance initialized to CSS color #2F4F4F
staticconstantCesium.Color.DARKTURQUOISE : Color
An immutable Color instance initialized to CSS color #00CED1
staticconstantCesium.Color.DARKVIOLET : Color
An immutable Color instance initialized to CSS color #9400D3
staticconstantCesium.Color.DEEPPINK : Color
An immutable Color instance initialized to CSS color #FF1493
staticconstantCesium.Color.DEEPSKYBLUE : Color
An immutable Color instance initialized to CSS color #00BFFF
staticconstantCesium.Color.DIMGRAY : Color
An immutable Color instance initialized to CSS color #696969
staticconstantCesium.Color.DIMGREY : Color
An immutable Color instance initialized to CSS color #696969
staticconstantCesium.Color.DODGERBLUE : Color
An immutable Color instance initialized to CSS color #1E90FF
staticconstantCesium.Color.FIREBRICK : Color
An immutable Color instance initialized to CSS color #B22222
staticconstantCesium.Color.FLORALWHITE : Color
An immutable Color instance initialized to CSS color #FFFAF0
staticconstantCesium.Color.FORESTGREEN : Color
An immutable Color instance initialized to CSS color #228B22
staticconstantCesium.Color.FUCHSIA : Color
An immutable Color instance initialized to CSS color #FF00FF
staticconstantCesium.Color.GAINSBORO : Color
An immutable Color instance initialized to CSS color #DCDCDC
staticconstantCesium.Color.GHOSTWHITE : Color
An immutable Color instance initialized to CSS color #F8F8FF
staticconstantCesium.Color.GOLD : Color
An immutable Color instance initialized to CSS color #FFD700
staticconstantCesium.Color.GOLDENROD : Color
An immutable Color instance initialized to CSS color #DAA520
staticconstantCesium.Color.GRAY : Color
An immutable Color instance initialized to CSS color #808080
staticconstantCesium.Color.GREEN : Color
An immutable Color instance initialized to CSS color #008000
staticconstantCesium.Color.GREENYELLOW : Color
An immutable Color instance initialized to CSS color #ADFF2F
staticconstantCesium.Color.GREY : Color
An immutable Color instance initialized to CSS color #808080
staticconstantCesium.Color.HONEYDEW : Color
An immutable Color instance initialized to CSS color #F0FFF0
staticconstantCesium.Color.HOTPINK : Color
An immutable Color instance initialized to CSS color #FF69B4
staticconstantCesium.Color.INDIANRED : Color
An immutable Color instance initialized to CSS color #CD5C5C
staticconstantCesium.Color.INDIGO : Color
An immutable Color instance initialized to CSS color #4B0082
staticconstantCesium.Color.IVORY : Color
An immutable Color instance initialized to CSS color #FFFFF0
staticconstantCesium.Color.KHAKI : Color
An immutable Color instance initialized to CSS color #F0E68C
staticconstantCesium.Color.LAVENDAR_BLUSH : Color
An immutable Color instance initialized to CSS color #FFF0F5
staticconstantCesium.Color.LAVENDER : Color
An immutable Color instance initialized to CSS color #E6E6FA
staticconstantCesium.Color.LAWNGREEN : Color
An immutable Color instance initialized to CSS color #7CFC00
staticconstantCesium.Color.LEMONCHIFFON : Color
An immutable Color instance initialized to CSS color #FFFACD
staticconstantCesium.Color.LIGHTBLUE : Color
An immutable Color instance initialized to CSS color #ADD8E6
staticconstantCesium.Color.LIGHTCORAL : Color
An immutable Color instance initialized to CSS color #F08080
staticconstantCesium.Color.LIGHTCYAN : Color
An immutable Color instance initialized to CSS color #E0FFFF
staticconstantCesium.Color.LIGHTGOLDENRODYELLOW : Color
An immutable Color instance initialized to CSS color #FAFAD2
staticconstantCesium.Color.LIGHTGRAY : Color
An immutable Color instance initialized to CSS color #D3D3D3
staticconstantCesium.Color.LIGHTGREEN : Color
An immutable Color instance initialized to CSS color #90EE90
staticconstantCesium.Color.LIGHTGREY : Color
An immutable Color instance initialized to CSS color #D3D3D3
staticconstantCesium.Color.LIGHTPINK : Color
An immutable Color instance initialized to CSS color #FFB6C1
staticconstantCesium.Color.LIGHTSEAGREEN : Color
一个不可变的颜色实例初始化为CSS颜色 #20B2AA(浅海洋绿)
staticconstantCesium.Color.LIGHTSKYBLUE : Color
An immutable Color instance initialized to CSS color #87CEFA
staticconstantCesium.Color.LIGHTSLATEGRAY : Color
An immutable Color instance initialized to CSS color #778899
staticconstantCesium.Color.LIGHTSLATEGREY : Color
An immutable Color instance initialized to CSS color #778899
staticconstantCesium.Color.LIGHTSTEELBLUE : Color
An immutable Color instance initialized to CSS color #B0C4DE
staticconstantCesium.Color.LIGHTYELLOW : Color
An immutable Color instance initialized to CSS color #FFFFE0
staticconstantCesium.Color.LIME : Color
An immutable Color instance initialized to CSS color #00FF00
staticconstantCesium.Color.LIMEGREEN : Color
An immutable Color instance initialized to CSS color #32CD32
staticconstantCesium.Color.LINEN : Color
An immutable Color instance initialized to CSS color #FAF0E6
staticconstantCesium.Color.MAGENTA : Color
An immutable Color instance initialized to CSS color #FF00FF
staticconstantCesium.Color.MAROON : Color
An immutable Color instance initialized to CSS color #800000
staticconstantCesium.Color.MEDIUMAQUAMARINE : Color
An immutable Color instance initialized to CSS color #66CDAA
staticconstantCesium.Color.MEDIUMBLUE : Color
An immutable Color instance initialized to CSS color #0000CD
staticconstantCesium.Color.MEDIUMORCHID : Color
An immutable Color instance initialized to CSS color #BA55D3
staticconstantCesium.Color.MEDIUMPURPLE : Color
An immutable Color instance initialized to CSS color #9370DB
staticconstantCesium.Color.MEDIUMSEAGREEN : Color
An immutable Color instance initialized to CSS color #3CB371
staticconstantCesium.Color.MEDIUMSLATEBLUE : Color
An immutable Color instance initialized to CSS color #7B68EE
staticconstantCesium.Color.MEDIUMSPRINGGREEN : Color
An immutable Color instance initialized to CSS color #00FA9A
staticconstantCesium.Color.MEDIUMTURQUOISE : Color
An immutable Color instance initialized to CSS color #48D1CC
staticconstantCesium.Color.MEDIUMVIOLETRED : Color
An immutable Color instance initialized to CSS color #C71585
staticconstantCesium.Color.MIDNIGHTBLUE : Color
An immutable Color instance initialized to CSS color #191970
staticconstantCesium.Color.MINTCREAM : Color
An immutable Color instance initialized to CSS color #F5FFFA
staticconstantCesium.Color.MISTYROSE : Color
An immutable Color instance initialized to CSS color #FFE4E1
staticconstantCesium.Color.MOCCASIN : Color
An immutable Color instance initialized to CSS color #FFE4B5
staticconstantCesium.Color.NAVAJOWHITE : Color
An immutable Color instance initialized to CSS color #FFDEAD
staticconstantCesium.Color.NAVY : Color
An immutable Color instance initialized to CSS color #000080
staticconstantCesium.Color.OLDLACE : Color
An immutable Color instance initialized to CSS color #FDF5E6
staticconstantCesium.Color.OLIVE : Color
An immutable Color instance initialized to CSS color #808000
staticconstantCesium.Color.OLIVEDRAB : Color
An immutable Color instance initialized to CSS color #6B8E23
staticconstantCesium.Color.ORANGE : Color
An immutable Color instance initialized to CSS color #FFA500
staticconstantCesium.Color.ORANGERED : Color
An immutable Color instance initialized to CSS color #FF4500
staticconstantCesium.Color.ORCHID : Color
An immutable Color instance initialized to CSS color #DA70D6
staticCesium.Color.packedLength : Number
The number of elements used to pack the object into an array.
staticconstantCesium.Color.PALEGOLDENROD : Color
An immutable Color instance initialized to CSS color #EEE8AA
staticconstantCesium.Color.PALEGREEN : Color
An immutable Color instance initialized to CSS color #98FB98
staticconstantCesium.Color.PALETURQUOISE : Color
An immutable Color instance initialized to CSS color #AFEEEE
staticconstantCesium.Color.PALEVIOLETRED : Color
An immutable Color instance initialized to CSS color #DB7093
staticconstantCesium.Color.PAPAYAWHIP : Color
An immutable Color instance initialized to CSS color #FFEFD5
staticconstantCesium.Color.PEACHPUFF : Color
An immutable Color instance initialized to CSS color #FFDAB9
staticconstantCesium.Color.PERU : Color
An immutable Color instance initialized to CSS color #CD853F
staticconstantCesium.Color.PINK : Color
An immutable Color instance initialized to CSS color #FFC0CB
staticconstantCesium.Color.PLUM : Color
An immutable Color instance initialized to CSS color #DDA0DD
staticconstantCesium.Color.POWDERBLUE : Color
An immutable Color instance initialized to CSS color #B0E0E6
staticconstantCesium.Color.PURPLE : Color
An immutable Color instance initialized to CSS color #800080
staticconstantCesium.Color.RED : Color
An immutable Color instance initialized to CSS color #FF0000
staticconstantCesium.Color.ROSYBROWN : Color
An immutable Color instance initialized to CSS color #BC8F8F
staticconstantCesium.Color.ROYALBLUE : Color
An immutable Color instance initialized to CSS color #4169E1
staticconstantCesium.Color.SADDLEBROWN : Color
An immutable Color instance initialized to CSS color #8B4513
staticconstantCesium.Color.SALMON : Color
An immutable Color instance initialized to CSS color #FA8072
staticconstantCesium.Color.SANDYBROWN : Color
An immutable Color instance initialized to CSS color #F4A460
staticconstantCesium.Color.SEAGREEN : Color
An immutable Color instance initialized to CSS color #2E8B57
staticconstantCesium.Color.SEASHELL : Color
An immutable Color instance initialized to CSS color #FFF5EE
staticconstantCesium.Color.SIENNA : Color
An immutable Color instance initialized to CSS color #A0522D
staticconstantCesium.Color.SILVER : Color
An immutable Color instance initialized to CSS color #C0C0C0
staticconstantCesium.Color.SKYBLUE : Color
An immutable Color instance initialized to CSS color #87CEEB
staticconstantCesium.Color.SLATEBLUE : Color
An immutable Color instance initialized to CSS color #6A5ACD
staticconstantCesium.Color.SLATEGRAY : Color
An immutable Color instance initialized to CSS color #708090
staticconstantCesium.Color.SLATEGREY : Color
An immutable Color instance initialized to CSS color #708090
staticconstantCesium.Color.SNOW : Color
An immutable Color instance initialized to CSS color #FFFAFA
staticconstantCesium.Color.SPRINGGREEN : Color
An immutable Color instance initialized to CSS color #00FF7F
staticconstantCesium.Color.STEELBLUE : Color
An immutable Color instance initialized to CSS color #4682B4
staticconstantCesium.Color.TAN : Color
An immutable Color instance initialized to CSS color #D2B48C
staticconstantCesium.Color.TEAL : Color
An immutable Color instance initialized to CSS color #008080
staticconstantCesium.Color.THISTLE : Color
An immutable Color instance initialized to CSS color #D8BFD8
staticconstantCesium.Color.TOMATO : Color
An immutable Color instance initialized to CSS color #FF6347
staticconstantCesium.Color.TRANSPARENT : Color
An immutable Color instance initialized to CSS transparent.
staticconstantCesium.Color.TURQUOISE : Color
An immutable Color instance initialized to CSS color #40E0D0
staticconstantCesium.Color.VIOLET : Color
An immutable Color instance initialized to CSS color #EE82EE
staticconstantCesium.Color.WHEAT : Color
An immutable Color instance initialized to CSS color #F5DEB3
staticconstantCesium.Color.WHITE : Color
An immutable Color instance initialized to CSS color #FFFFFF
staticconstantCesium.Color.WHITESMOKE : Color
An immutable Color instance initialized to CSS color #F5F5F5
staticconstantCesium.Color.YELLOW : Color
An immutable Color instance initialized to CSS color #FFFF00
staticconstantCesium.Color.YELLOWGREEN : Color
An immutable Color instance initialized to CSS color #9ACD32
alpha : Number
The alpha component.
Default Value: 1.0
blue : Number
The blue component.
Default Value: 1.0
green : Number
The green component.
Default Value: 1.0
red : Number
The red component.
Default Value: 1.0

内置方法

staticCesium.Color.add(left, right, result)Color
Computes the componentwise sum of two Colors.
Name Type Description
left Color The first Color.
right Color The second Color.
result Color The object onto which to store the result.
返回值:
The modified result parameter.
staticCesium.Color.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.
返回值:
The converted number.
staticCesium.Color.clone(color, result)Color
复制颜色。
Name Type Description
color Color 要复制的颜色。
result Color optional 存储结果的对象,如果未定义,将创建一个新实例。
返回值:
修改后的结果参数或如果结果未定义,则为新实例。(如果颜色未定义,则返回未定义)
staticCesium.Color.divide(left, right, result)Color
Computes the componentwise quotient of two Colors.
Name Type Description
left Color The first Color.
right Color The second Color.
result Color The object onto which to store the result.
返回值:
The modified result parameter.
staticCesium.Color.divideByScalar(color, scalar, result)Color
Divides the provided Color componentwise by the provided scalar.
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.
返回值:
The modified result parameter.
staticCesium.Color.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.
返回值:
true if the Colors are equal; otherwise, false.
staticCesium.Color.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.
返回值:
The converted number.
staticCesium.Color.fromAlpha(color, alpha, result)Color
创建一个新颜色,该颜色具有与指定颜色相同的红色、绿色和蓝色分量,但具有新指定的alpha值。
Name Type Description
color Color 基础颜色。
alpha Number 新alpha分量。
result Color optional 存储结果的对象。
返回值:
修改后的结果参数或如果未提供则为新颜色实例。
示例:
var translucentRed = Cesium.Color.fromAlpha(Cesium.Color.RED, 0.9);
staticCesium.Color.fromBytes(red, green, blue, alpha, result)Color
创建使用红、绿、蓝和alpha值指定的新颜色*范围在0到255之间的值,在内部转换为范围0.0到1.0。
Name Type Default Description
red Number 255 optional 红色分量。
green Number 255 optional 绿色分量。
blue Number 255 optional 蓝色分量。
alpha Number 255 optional alpha分量。
result Color optional 存储结果的对象。
返回值:
修改后的结果参数,或者如果没有提供一个颜色实例,则使用一个新的颜色实例。
staticCesium.Color.fromCartesian4(cartesian, result)Color
Creates a Color instance from a Cartesian4. x, y, z, and w map to red, green, blue, and alpha, respectively.
Name Type Description
cartesian Cartesian4 The source cartesian.
result Color optional The object onto which to store the result.
返回值:
The modified result parameter or a new Color instance if one was not provided.
staticCesium.Color.fromCssColorString(color, result)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.
result Color optional The object to store the result in, if undefined a new instance will be created.
返回值:
The color object, or undefined if the string was not a valid CSS color.
示例:
var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF');
var green = Cesium.Color.fromCssColorString('green');
参考:
staticCesium.Color.fromHsl(hue, saturation, lightness, alpha, result)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
result Color optional The object to store the result in, if undefined a new instance will be created.
返回值:
The color object.
参考:
staticCesium.Color.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.
返回值:
The modified result parameter or a new instance if result was undefined.
异常情况:
  • 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.
示例:
//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
});
staticCesium.Color.fromRgba(rgba, result)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.
result Color optional The object to store the result in, if undefined a new instance will be created.
返回值:
The color object.
示例:
var color = Cesium.Color.fromRgba(0x67ADDFFF);
参考:
staticCesium.Color.mod(left, right, result)Color
Computes the componentwise modulus of two Colors.
Name Type Description
left Color The first Color.
right Color The second Color.
result Color The object onto which to store the result.
返回值:
The modified result parameter.
staticCesium.Color.multiply(left, right, result)Color
Computes the componentwise product of two Colors.
Name Type Description
left Color The first Color.
right Color The second Color.
result Color The object onto which to store the result.
返回值:
The modified result parameter.
staticCesium.Color.multiplyByScalar(color, scalar, result)Color
Multiplies the provided Color componentwise by the provided scalar.
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.
返回值:
The modified result parameter.
staticCesium.Color.pack(value, array, startingIndex)Array.<Number>
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.
返回值:
The array that was packed into
staticCesium.Color.subtract(left, right, result)Color
Computes the componentwise difference of two Colors.
Name Type Description
left Color The first Color.
right Color The second Color.
result Color The object onto which to store the result.
返回值:
The modified result parameter.
staticCesium.Color.unpack(array, startingIndex, result)Color
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.
返回值:
The modified result parameter or a new Color instance if one was not provided.
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.
返回值:
The modified result parameter.
示例:
var brightBlue = Cesium.Color.BLUE.brighten(0.5, new Cesium.Color());
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.
返回值:
The modified result parameter or a new instance if result was undefined.
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.
返回值:
The modified result parameter.
示例:
var darkBlue = Cesium.Color.BLUE.darken(0.5, new Cesium.Color());
equals(other)Boolean
Returns true if this Color equals other.
Name Type Description
other Color The Color to compare for equality.
返回值:
true if the Colors are equal; otherwise, false.
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.
返回值:
true if the Colors are equal within the specified epsilon; otherwise, false.
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.
返回值:
The modified result parameter or a new instance if result was undefined.
toCssColorString()String
创建一个包含此颜色的CSS颜色值的字符串。
返回值:
相当于CSS的这种颜色。
参考:
toRgba()Number
Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness of the system.
返回值:
A single numeric unsigned 32-bit RGBA value.
示例:
var rgba = Cesium.Color.BLUE.toRgba();
参考:
toString()String
Creates a string representing this Color in the format '(red, green, blue, alpha)'.
返回值:
A string representing this Color in the format '(red, green, blue, alpha)'.
withAlpha(alpha, result)Color
创建与此颜色具有相同的红、绿和蓝分量的新颜色,但具有指定的alpha值。
Name Type Description
alpha Number 新的alpha分量。
result Color optional 存储结果的对象。
返回值:
修改后的结果参数或如果未提供则为新颜色实例。
示例:
var translucentRed = Cesium.Color.RED.withAlpha(0.9);

其他API

Cesium中文API文档手册(v1.63.1版本)参考:《Cesium中文API文档手册(v1.63.1版本)

相关阅读

麻辣GIS-Sailor

作者:

GIS爱好者,学GIS,更爱玩GIS。

声明

1.本文所分享的所有需要用户下载使用的内容(包括但不限于软件、数据、图片)来自于网络或者麻辣GIS粉丝自行分享,版权归该下载资源的合法拥有者所有,如有侵权请第一时间联系本站删除。

2.下载内容仅限个人学习使用,请切勿用作商用等其他用途,否则后果自负。

手机阅读
公众号关注
知识星球
手机阅读
麻辣GIS微信公众号关注
最新GIS干货
关注麻辣GIS知识星球
私享圈子

留言板(小编看到第一时间回复)