web:compat x5 core
This commit is contained in:
parent
2fe2cded48
commit
c54c4442b5
@ -40,17 +40,11 @@ export function pixelString2Number(v: string) {
|
|||||||
export function toRGBAString(color: number) {
|
export function toRGBAString(color: number) {
|
||||||
let strs = []
|
let strs = []
|
||||||
for (let i = 0; i < 32; i += 8) {
|
for (let i = 0; i < 32; i += 8) {
|
||||||
|
strs.push(((color >> i) & 0xff))
|
||||||
strs.push(((color >> i) & 0xff).toString(16))
|
|
||||||
}
|
}
|
||||||
strs = strs.map(e => {
|
strs = strs.reverse()
|
||||||
if (e.length === 1) {
|
/// RGBAd
|
||||||
return '0' + e
|
return `rgba(${strs[1]},${strs[2]},${strs[3]},${strs[0] / 255})`
|
||||||
}
|
|
||||||
return e
|
|
||||||
}).reverse()
|
|
||||||
/// RGBA
|
|
||||||
return `#${strs[1]}${strs[2]}${strs[3]}${strs[0]}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user