颜色转换
This commit is contained in:
parent
4641e9ecee
commit
4d6af76e47
@ -181,4 +181,12 @@ export class ChangeUtil {
|
|||||||
}
|
}
|
||||||
return length as number; // 已经是数值类型
|
return length as number; // 已经是数值类型
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将HEX颜色转换为RGBA格式
|
||||||
|
static hexToRgba (hex: string, alpha: number) : string | ResourceStr {
|
||||||
|
const r = parseInt(hex.slice(1, 3), 16);
|
||||||
|
const g = parseInt(hex.slice(3, 5), 16);
|
||||||
|
const b = parseInt(hex.slice(5, 7), 16);
|
||||||
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user