/**
* rgb数组转字符串hex
* @param {array} rgb [255,0,0]
* @returns hex颜色 "#ffffff"
*/
export function color2RGB (rgb) {
    var hex = "#" + color2RGBValue(rgb)
    return hex
}

/**
* rgb数组转字符串hex
* @param {array} rgb [255,0,0]
* @returns hex颜色值 "ffffff"
*/
export function color2RGBValue (rgb) {
    var r = rgb[0]
    var g = rgb[1]
    var b = rgb[2]
    var hex = ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)
    return hex
}

/**
* rgba数组转字符串hex
* @param {array} rgba [255,0,0,1]
* @returns hex颜色值 "ffffffff"
*/
export function color2RGBAValue (rgba) {
    var r = rgba[0]
    var g = rgba[1]
    var b = rgba[2]
    var hex = ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)
    var a = rgba[3]
    hex += (a * 255).toString(16)
    return hex
}