rgb2hex(rgb) {
if (rgb.charAt(0) == '#') {
return rgb
} else {
var ds = rgb.split(/\D+/)
var decimal = Number(ds[1]) * 65536 + Number(ds[2]) * 256 + Number(ds[3])
return this.zero_fill_hex(decimal, 6)
}
}
zero_fill_hex(num, digits) {
var s = num.toString(16)
if (s.length < digits) {
s = '0' + s
}
return s
},
this.colorin = this.rgb2hex(obj.color)
网友评论