From c54c4442b5c74228458bdd1635db68dd5051c9a8 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 19 Apr 2021 19:56:00 +0800 Subject: [PATCH] web:compat x5 core --- doric-web/src/shader/DoricViewNode.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/doric-web/src/shader/DoricViewNode.ts b/doric-web/src/shader/DoricViewNode.ts index 28b07d9e..09d2533e 100644 --- a/doric-web/src/shader/DoricViewNode.ts +++ b/doric-web/src/shader/DoricViewNode.ts @@ -40,17 +40,11 @@ export function pixelString2Number(v: string) { export function toRGBAString(color: number) { let strs = [] for (let i = 0; i < 32; i += 8) { - - strs.push(((color >> i) & 0xff).toString(16)) + strs.push(((color >> i) & 0xff)) } - strs = strs.map(e => { - if (e.length === 1) { - return '0' + e - } - return e - }).reverse() - /// RGBA - return `#${strs[1]}${strs[2]}${strs[3]}${strs[0]}` + strs = strs.reverse() + /// RGBAd + return `rgba(${strs[1]},${strs[2]},${strs[3]},${strs[0] / 255})` }