MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / hexToRgb

Method hexToRgb

src/openlayers/core/StyleUtils.js:925–935  ·  view source on GitHub ↗

* @function StyleUtils.hexToRgb * @description 将16进制的颜色,转换成rgb格式 * @param {string} hexColor 16进制颜色 * @returns {string} rgb格式的颜色

(hexColor)

Source from the content-addressed store, hash-verified

923 * @returns {string} rgb格式的颜色
924 */
925 static hexToRgb(hexColor) {
926 if (!hexColor) {
927 return;
928 }
929 var s = hexColor.replace('#', '').split('');
930 var rgb = [s[0] + s[1], s[2] + s[3], s[4] + s[5]];
931 rgb = rgb.map(function (hex) {
932 return parseInt(hex, 16);
933 });
934 return rgb;
935 }
936
937 /**
938 * @function StyleUtils.formatRGB

Callers 5

toOpenLayersStyleMethod · 0.95
getRoadPathMethod · 0.95
getPathwayMethod · 0.95
getSymbolStyleMethod · 0.80
setColorToCanvasMethod · 0.80

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected