diff --git a/src/utils/utils.ts b/src/utils/utils.ts index b37337dcd6ba195f2cbe4036b44c0575d5a5c042..c334a80219b326142452bd69f8c3d6575fbcf688 100755 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -33,7 +33,7 @@ export function hexToRgba( opacity: number ): { red: number; green: number; blue: number; rgba: string } { // 移除可能存在的 # 前缀并转换为大写 - hex = hex.replace(/^#/, '').toUpperCase() + hex = hex.trim().replace(/^#/, '').toUpperCase() // 如果是缩写形式(如 FFF),转换为完整形式 if (hex.length === 3) {