new Color(red, green, blue, alpha)
base/Color.js, line 4
颜色类
| Name | Type | Default | Description |
|---|---|---|---|
red |
Number | 0.0 |
可选
红色 |
green |
Number | 0.0 |
可选
绿色 |
blue |
Number | 0.0 |
可选
蓝色 |
alpha |
Number | 1.0 |
可选
透明度 |
Methods
-
Color.fromColor(color){Color}
base/Color.js, line 244 -
转换为color对象
Name Type Description colorColor | String hex字符串或rgba字符串或Color对象
Returns:
Type Description Color 转换后的颜色对象 -
Color.fromCssString(cssString){Color}
base/Color.js, line 228 -
将Css字符串颜色转为Color
Name Type Description cssStringString Css字符串颜色
Returns:
Type Description Color 转换后的颜色对象 -
Color.fromHexString(hex){Color}
base/Color.js, line 111 -
将hex字符串转成一个Color对象
Name Type Description hexString hex字符串
Returns:
Type Description Color Color对象 -
Color.fromJSON(json){Color}
base/Color.js, line 128 -
将json转成一个Color对象
Name Type Description jsonString json对象
Returns:
Type Description Color Color对象 -
Color.fromRGBString(rgb){Color}
base/Color.js, line 77 -
将rgb或rgba字符串转成一个Color对象
Name Type Description rgbString rgb或rgba字符
Returns:
Type Description Color Color对象 -
Color.hexToRgb(hex){String}
base/Color.js, line 142 -
将hex字符串转成一个rgb字符串
Name Type Description hexString hex字符串
Returns:
Type Description String rgb字符串 -
Color.isHex(hex){Boolean}
base/Color.js, line 276 -
判断是否是hex字符串
Name Type Description hexString hex字符串
Returns:
Type Description Boolean 是否是hex字符串 -
Color.isRGB(rgb){Boolean}
base/Color.js, line 288 -
判断是否是rgb字符串
Name Type Description rgbString rgb字符串
Returns:
Type Description Boolean 是否是rgb字符串 -
Color.rgbToHex(rgb){String}
base/Color.js, line 185 -
将rgb字符串转成一个hex字符串
Name Type Description rgbString rgb字符串
Returns:
Type Description String hex字符串 -
clone(){Color}
base/Color.js, line 54 -
克隆字符串
Returns:
Type Description Color 颜色对象 -
toCesiumRGB(){Object}
base/Color.js, line 25 -
转为cesium的rgba值
Returns:
Type Description Object cesium的rgba值 -
toCssRGBAString(){String}
base/Color.js, line 38 -
转为rgba字符串
Returns:
Type Description String rgba字符串 -
toCssRGBString(){String}
base/Color.js, line 46 -
转为rgb字符串
Returns:
Type Description String rgb字符串 -
toJSON(){Object}
base/Color.js, line 62 -
导出为JSON对象
Returns:
Type Description Object JSON对象